|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tv.amwa.maj.embeddable.TimeStamp
public final class TimeStamp
Implementation of a date and time in UTC (Coordinated Universal Time). The value is made up of a date and time structure.
The internal representation of this value is a Calendar
value.
A time stamp structure is represented in the database by a column of type date:
`Date` date
TimeStamp
,
DateStruct
,
TimeStruct
,
TypeDefinitionRecord.TimeStamp
,
Calendar
,
Serialized FormConstructor Summary | |
---|---|
TimeStamp()
Create a new time stamp value to represent the time now. |
|
TimeStamp(Calendar calendarItem)
Create a new time stamp from the given calendar value. |
|
TimeStamp(DateStruct date,
TimeStruct time)
Create a new time stamp from the given date and time structures. |
Method Summary | |
---|---|
void |
appendXMLChildren(Node parent)
Append child elements to the given parent node to serialize the value of an object to an XML fragment. |
static TimeStamp |
castFromInterface(TimeStamp alien)
Cast a value the implements the TimeStamp interface
to concrete value of this implementation. |
TimeStamp |
clone()
Creates a cloned deep copy of this embeddable value. |
boolean |
equals(Object o)
Checks for the equality of UTC values only and not the exact equality of the underlying calendar value representation. |
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()
Returns a hash code value for this embeddable object. |
static TimeStamp |
parseTimeStamp(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 |
setPropertiesFromInterface(TimeStamp castFrom)
Set the properties of this value from another value that implements that implements the TimeStamp interface. |
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. |
String |
toString()
Formats the string according ISO 8601 and as a UTC value. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TimeStamp()
Create a new time stamp value to represent the time now.
public TimeStamp(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 TimeStamp(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.Method Detail |
---|
public static final TimeStamp castFromInterface(TimeStamp alien) throws NullPointerException
Cast a value the implements the TimeStamp
interface
to concrete value of this implementation.
alien
- Value to cast to a concrete instance.
NullPointerException
- Argument is null
.public final void setPropertiesFromInterface(TimeStamp castFrom) throws NullPointerException
Set the properties of this value from another value that implements that
implements the TimeStamp
interface.
castFrom
- Value to use to set this timecode value.
NullPointerException
- The given time stamp value is null
.public final DateStruct getDate()
TimeStamp
Returns the date component of the time stamp.
getDate
in interface TimeStamp
public final void setDate(DateStruct date) throws NullPointerException, IllegalArgumentException
TimeStamp
Sets the date component of the time stamp.
setDate
in interface TimeStamp
date
- Date component of the time stamp.
NullPointerException
- The given data structure is null
.
IllegalArgumentException
- The given date is not valid.public final TimeStruct getTime()
TimeStamp
Returns the time component of the time stamp.
getTime
in interface TimeStamp
public final void setTime(TimeStruct time) throws NullPointerException, IllegalArgumentException
TimeStamp
Sets the time component of the time stamp.
setTime
in interface TimeStamp
time
- 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
TimeStamp
Simultaneously sets the date and time components of the time stamp.
setStamp
in interface TimeStamp
date
- 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()
Returns a calendar value representing this time stamp. The method returns a copy of internal calendar value to preserve the internal state of this value.
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 MAJCommon
toString
in class Object
Object.toString()
,
SimpleDateFormat
public final int hashCode()
MAJCommon
Returns a hash code value for this embeddable object.
hashCode
in interface MAJCommon
hashCode
in class Object
Object.hashCode()
public static final TimeStamp parseTimeStamp(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 100ths 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 interface MAJCommon
equals
in class Object
o
- Object to test for equality with.
Object.equals(java.lang.Object)
public final TimeStamp clone()
MAJCommon
Creates a cloned deep copy of this embeddable value. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.
This method does not throw a CloneNotSupportedException
as all
embeddable values must implement the Cloneable
interface.
clone
in interface MAJCommon
clone
in class Object
Object.clone()
public final void appendXMLChildren(Node parent)
XMLSerializable
Append 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 XMLSerializable
parent
- XML parent element to append child nodes to.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |