public final class TimeStampImpl extends Object implements TimeStamp, Serializable, XMLSerializable, Cloneable
| Modifier and Type | Field and Description |
|---|---|
static String |
MYSQL_COLUMN_DEFINITION |
| Constructor and Description |
|---|
TimeStampImpl()
Create a new time stamp value to represent the time now.
|
TimeStampImpl(Calendar calendarItem)
Create a new time stamp from the given calendar value.
|
TimeStampImpl(DateStruct date,
TimeStruct time)
Create a new time stamp from the given date and time structures.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendXMLChildren(Node parent)
Append extra child elements to the given parent node to serialize the value of an object
to an XML fragment.
|
TimeStamp |
clone()
Create a cloned copy of this time stamp.
|
boolean |
equals(Object o)
Checks for the equality of UTC values only and not the exact equality of
the underlying calendar value representation.
|
static TimeStamp |
fromPersistentForm(String timeStamp) |
static void |
generateEmbeddableORM(Node parent,
String namespace,
String prefix) |
static void |
generateEmbeddedORM(Node parent,
String ownerName,
String namespace,
String prefix) |
String |
getComment()
Include a comment when serializing a value to XML.
|
DateStruct |
getDate()
Returns the date component of the time stamp.
|
TimeStruct |
getTime()
Returns the time component of the time stamp.
|
Calendar |
getTimeStamp()
Returns a calendar value representing this time stamp.
|
int |
hashCode() |
static TimeStampImpl |
parseFactory(String stamp)
Create a time stamp from a string that is formatted according to the UTC standards.
|
void |
setDate(DateStruct date)
Sets the date component of the time stamp.
|
void |
setStamp(DateStruct date,
TimeStruct time)
Simultaneously sets the date and time components of the time stamp.
|
void |
setTime(TimeStruct time)
Sets the time component of the time stamp.
|
void |
setTimeStamp(Calendar timestampItem)
Set the value of this time stamp using a
Calendar value. |
static String |
toPersistentForm(TimeStamp timeStamp) |
String |
toString()
Formats the string according ISO 8601 and as a UTC value.
|
public static final String MYSQL_COLUMN_DEFINITION
public TimeStampImpl()
Create a new time stamp value to represent the time now.
public TimeStampImpl(Calendar calendarItem) throws IllegalArgumentException, NullPointerException
Create a new time stamp from the given calendar value.
calendarItem - Calendar value to use to create a new time stamp.IllegalArgumentException - The resulting time stamp value would not be valid.NullPointerException - Argument is null.public TimeStampImpl(DateStruct date, TimeStruct time) throws NullPointerException, IllegalArgumentException
Create a new time stamp from the given date and time structures.
date - Date to set for the new time stamp.time - Time to set for the new time stamp.NullPointerException - One or more of the arguments is null.IllegalArgumentException - The resulting time stamp value would not be valid.public final DateStruct getDate()
TimeStampReturns the date component of the time stamp.
public final void setDate(DateStruct date) throws NullPointerException, IllegalArgumentException
TimeStampSets the date component of the time stamp.
setDate in interface TimeStampdate - Date component of the time stamp.NullPointerException - The given data structure is null.IllegalArgumentException - The given date is not valid.public final TimeStruct getTime()
TimeStampReturns the time component of the time stamp.
public final void setTime(TimeStruct time) throws NullPointerException, IllegalArgumentException
TimeStampSets the time component of the time stamp.
setTime in interface TimeStamptime - Time component of the time stamp.NullPointerException - The given time structure is null.IllegalArgumentException - The given time is not valid.public final void setStamp(DateStruct date, TimeStruct time) throws NullPointerException, IllegalArgumentException
TimeStampSimultaneously sets the date and time components of the time stamp.
setStamp in interface TimeStampdate - Date component of the time stamp.time - Time component of the time stamp.NullPointerException - One or both of the given data or time structures are null.IllegalArgumentException - One or both of the given date or time values are not valid.public final Calendar getTimeStamp()
TimeStampReturns a calendar value representing this time stamp. The method returns a copy of internal calendar value to preserve the internal state of this value.
getTimeStamp in interface TimeStampForge.makeTimeStamp(Calendar)public final void setTimeStamp(Calendar timestampItem) throws NullPointerException, IllegalArgumentException
Set the value of this time stamp using a Calendar value.
This method is strict in its interpretation of date and time values.
Note that all fields of the value will be preserved within the time stamp value and
available on a call to getTimeStamp().
timestampItem - Calendar value to use to set the value of this time stamp.NullPointerException - Argument is null.IllegalArgumentException - The given calendar value is not a valid date or time.public final String toString()
Formats the string according ISO 8601 and as a UTC value.
The format of the string is "yyyy-MM-dd'T'HH:mm:ss.SSZ", where:
toString in interface TimeStamptoString in class ObjectObject.toString(),
SimpleDateFormatpublic static final TimeStampImpl parseFactory(String stamp) throws ParseException, NullPointerException
Create a time stamp from a string that is formatted according to the UTC standards. If
the value is given with a timezone part, the internal representation will be
converted to UTC "+0000", otherwise kwown as "Z".
One acceptable format of the string is "yyyy-MM-dd'T'HH:mm:ss.SSSZ", where:
Alternatively, a "Z" may be used in place of "+0000". The
number of milliseconds can be expressed by 1/250ths of a second.
stamp - String representation of a time stamp value.ParseException - A problem with the given string prevents it from being converted
to a time stamp value, or the resulting value in unacceptable.NullPointerException - Argument is null.public final boolean equals(Object o)
Checks for the equality of UTC values only and not the exact equality of the underlying calendar value representation.
equals in class ObjectObject.equals(java.lang.Object)public final TimeStamp clone()
TimeStampCreate a cloned copy of this time stamp.
public final void appendXMLChildren(Node parent)
XMLSerializableAppend extra child elements to the given parent node to serialize the value of an object
to an XML fragment. Methods of the XMLBuilder class are provided to help with this
process.
appendXMLChildren in interface XMLSerializableparent - XML parent element to append child nodes to.public String getComment()
XMLSerializableInclude a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.
getComment in interface XMLSerializablepublic static final void generateEmbeddableORM(Node parent, String namespace, String prefix)
public static final void generateEmbeddedORM(Node parent, String ownerName, String namespace, String prefix)
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.