org.caleigo.core
Class DateProxyData

java.lang.Object
  extended byorg.caleigo.core.DateProxyData
All Implemented Interfaces:
IProxyData, java.io.Serializable

public class DateProxyData
extends java.lang.Object
implements IProxyData

DateProxyData is an IProxyData implementation that can be used to obtain the current time and/or date-data relative to the current time. It can for instance be used as the default value on an entity date field.

Version:
1.00 WHEN WHO WHY & WHAT ----------------------------------------------------------------------------- 003-01-03 Dennis Zikovic Creation
Author:
Dennis Zikovic
See Also:
Serialized Form

Field Summary
static int NOW
          Specifies that the current time at the call to getData should be used with a millisecond resolution.
static int TODAY
          Specifies that the current date at the call to getData should be used with all time data (hour or higher resolution) should be set to zero.
 
Constructor Summary
DateProxyData()
          Creates a new instance of DateProxyData with the type NOW.
DateProxyData(int type)
          Creates a new instance of DateProxyData with the provided type.
DateProxyData(int type, int modifierType, int modifierAmount)
          Creates a new instance of DateProxyData with the provided type and the provided modifier data.
 
Method Summary
static java.lang.Object convertToDateObject(java.lang.Object data)
          Used to convert an object to a Date Object, either the java.util.Date object or a DateProxyData object.
 java.lang.Object getData()
           
 DataType getDataType()
           
 int getType()
           
 int mModifierAmount()
           
 int mModifierType()
           
static DateProxyData parse(java.lang.String typeString)
          Parses a string to a DateProxyData instance. wlaid strings are "NOW" or "TODAY" followed by an optional modifier in the format "+/-[]".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOW

public static final int NOW
Specifies that the current time at the call to getData should be used with a millisecond resolution.

See Also:
Constant Field Values

TODAY

public static final int TODAY
Specifies that the current date at the call to getData should be used with all time data (hour or higher resolution) should be set to zero.

See Also:
Constant Field Values
Constructor Detail

DateProxyData

public DateProxyData()
Creates a new instance of DateProxyData with the type NOW.


DateProxyData

public DateProxyData(int type)
Creates a new instance of DateProxyData with the provided type.

Parameters:
type - The type to use NOW or TODAY.

DateProxyData

public DateProxyData(int type,
                     int modifierType,
                     int modifierAmount)
Creates a new instance of DateProxyData with the provided type and the provided modifier data.

Parameters:
type - The type to use NOW or TODAY.
modifierType - The modifier type shoult be Calendar field constant.
modifierAmount - The modifier amount is positive or negative integer.
Method Detail

parse

public static DateProxyData parse(java.lang.String typeString)
Parses a string to a DateProxyData instance. wlaid strings are "NOW" or "TODAY" followed by an optional modifier in the format "+/-[]". Valid type sufixes are Y(year), M(month), D(day), W(week), h(hour), m(minute), s(second) or S(millisecond). If the suffix is omited day type is assumed as the modifier type. Examples are TODAY+1 = tomorow midnight or NOW-2h = exactly two hours ago from now.

Parameters:
typeString - the String tha tshould be parsed
Returns:
a DateProxyData instance containing the parsed date

convertToDateObject

public static java.lang.Object convertToDateObject(java.lang.Object data)
Used to convert an object to a Date Object, either the java.util.Date object or a DateProxyData object.

Parameters:
data - The data representing a Date
Returns:
Object The created data object

getData

public java.lang.Object getData()
Specified by:
getData in interface IProxyData

getDataType

public DataType getDataType()
Specified by:
getDataType in interface IProxyData

getType

public int getType()

mModifierType

public int mModifierType()

mModifierAmount

public int mModifierAmount()


Copyright © 2005 Caleigo. All Rights Reserved.