|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xins.common.types.Type
org.xins.common.types.standard.Date
Standard type _date. A value of this type represents a certain moment in time, with day-precision, without an indication of the time zone.
The textual representation of a timestamp is always 8 numeric characters, in the format:
YYYYMMDDwhere:
"2005".
"12" for December.
"31" for the last day of December.
Note that all timestamps will be based on the current time zone (see
TimeZone.getDefault()).
A number of milliseconds can be used to indicate a specific instant in time. This number of milliseconds is since the UNIX Epoch.
| Nested Class Summary | |
static class |
Date.Value
Value for the type _date. |
| Field Summary | |
static Date |
SINGLETON
The only instance of this class. |
| Method Summary | |
static Date.Value |
fromStringForOptional(String string)
Constructs a Date.Value from the specified string. |
static Date.Value |
fromStringForRequired(String string)
Constructs a Date.Value from the specified string
which is guaranteed to be non-null. |
protected Object |
fromStringImpl(String string)
Converts from a String to an instance of the value class
for this type (implementation method). |
String |
getDescription()
Retrieves the description of this type. |
protected boolean |
isValidValueImpl(String value)
Determines if the specified String value is considered
valid for this type (implementation method). |
static Date.Value |
today()
Constructs a Date.Value with the value of the current date. |
static String |
toString(Date.Value value)
Converts the specified Date.Value to a string. |
String |
toString(Object value)
Generates a string representation of the specified value for this type. |
| Methods inherited from class org.xins.common.types.Type |
checkValue, fromString, getName, getValueClass, isValidValue, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Date SINGLETON
null.
| Method Detail |
public static Date.Value today()
Date.Value with the value of the current date.
Date.Value for today, never null.
public static Date.Value fromStringForRequired(String string)
throws IllegalArgumentException,
TypeValueException
Date.Value from the specified string
which is guaranteed to be non-null.
string - the string to convert in the ISO format YYYYMMDD, cannot be null.
Date.Value object, never null.
IllegalArgumentException - if string == null.
TypeValueException - if the specified string does not represent a valid value for this
type.
public static Date.Value fromStringForOptional(String string)
throws TypeValueException
Date.Value from the specified string.
string - the string to convert in the ISO format YYYYMMDD, can be null.
Date.Value, or null if
string == null.
TypeValueException - if the specified string does not represent a valid value for this
type.public static String toString(Date.Value value)
Date.Value to a string.
value - the value to convert, can be null.
null if and only if value == null.protected final boolean isValidValueImpl(String value)
TypeString value is considered
valid for this type (implementation method).
This method is called from Type.isValidValue(String). When
called from that method, it is guaranteed that the argument is not
null.
Type returns
true.
isValidValueImpl in class Typevalue - the String value that should be checked for validity,
never null.
true if and only if the specified String
value is valid, false otherwise.
protected final Object fromStringImpl(String string)
throws TypeValueException
TypeString to an instance of the value class
for this type (implementation method).
This method is not required to check the validity of the specified
value (since Type.isValidValueImpl(String) should have been called
before) but if it does, then it may throw a TypeValueException.
fromStringImpl in class Typestring - the string to convert to an instance of the value class, guaranteed
to be not null and guaranteed to have been passed to
Type.isValidValueImpl(String) without getting an exception.
null.
TypeValueException - if string is considered to be an invalid value for this
type.
public final String toString(Object value)
throws IllegalArgumentException,
ClassCastException,
TypeValueException
TypeType.getValueClass()). Also, it may have to fall within a
certain range of valid values, depending on the type.
The default implementation of this method in class Type does
the following:
value == null then it throws an
IllegalArgumentException;
getValueClass().isInstance(value) == false then
it throws a ClassCastException;
value.Object.toString().
toString in class Typevalue - the value, cannot be null.
null.
IllegalArgumentException - if value == null.
TypeValueException - if the specified value is not in the allowed range.
ClassCastException - if getValueClass().isInstance(value) == false.public String getDescription()
Type
getDescription in class Typenull.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||