net.sf.asterisk.util
Class DateUtil

java.lang.Object
  extended by net.sf.asterisk.util.DateUtil

public class DateUtil
extends java.lang.Object

Utility class to obtain the current date and allows to override with a fixed value for testing.

Version:
$Id: DateUtil.java,v 1.1 2005/03/11 15:31:47 srt Exp $
Author:
srt

Method Summary
static java.util.Date getDate()
          Returns the real current date or the date set with overrideCurrentDate().
static void overrideCurrentDate(java.util.Date currentDate)
          If set to a non null value uses the date given as current date on calls to getDate().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

overrideCurrentDate

public static void overrideCurrentDate(java.util.Date currentDate)
If set to a non null value uses the date given as current date on calls to getDate(). Set to null to restore the normal behavior.

Parameters:
currentDate - the date to return on calls to getDate() or null to return the real current date.

getDate

public static java.util.Date getDate()
Returns the real current date or the date set with overrideCurrentDate().

Returns:
the real current date or the date set with overrideCurrentDate().


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.