Package org.cip4.lib.xjdf.type
Class DateTime
- java.lang.Object
-
- jakarta.xml.bind.annotation.adapters.XmlAdapter<ValueType,BoundType>
-
- org.cip4.lib.xjdf.type.AbstractXJdfType<java.lang.String,DateTime>
-
- org.cip4.lib.xjdf.type.DateTime
-
public class DateTime extends AbstractXJdfType<java.lang.String,DateTime>
Implementation of the XJDF DateTime data type.
-
-
Constructor Summary
Constructors Constructor Description DateTime()Default constructor.DateTime(int year, int month, int day)Custom constructor.DateTime(int year, int month, int day, int hour, int minute)Custom constructor.DateTime(int year, int month, int day, int hour, int minute, int second)Custom constructor.DateTime(java.lang.String dateTime)Creates a XJDF DateTime instance by a String expression object.DateTime(java.util.Date date)Creates a XJDF DateTime instance by a Date object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.CalendargetCalendar()Clones the underlying calendar and returns it.java.lang.Stringmarshal(DateTime dateTime)java.lang.StringtoString()java.lang.StringtoString(java.util.TimeZone timeZone)Formats this DateTime object using the passed time zone.DateTimeunmarshal(java.lang.String dateTime)-
Methods inherited from class org.cip4.lib.xjdf.type.AbstractXJdfType
equals, hashCode
-
-
-
-
Constructor Detail
-
DateTime
public DateTime()
Default constructor.
-
DateTime
public DateTime(int year, int month, int day)Custom constructor. Accepting values for initializing.- Parameters:
year- The value used to set the YEAR.month- The value used to set the MONTH in year. January is "0".day- The value used to set the DAY in month.
-
DateTime
public DateTime(int year, int month, int day, int hour, int minute)Custom constructor. Accepting values for initializing.- Parameters:
year- The value used to set the YEAR.month- The value used to set the MONTH in year. January is "0".day- The value used to set the DAY in month.hour- The value used to set the HOUR of day.minute- The value used to set the MINUTE in of.
-
DateTime
public DateTime(int year, int month, int day, int hour, int minute, int second)Custom constructor. Accepting values for initializing.- Parameters:
year- The value used to set the YEAR.month- The value used to set the MONTH in year. January is "0".day- The value used to set the DAY in month.hour- The value used to set the HOUR of day.minute- The value used to set the MINUTE.second- The value used to set the SECOND.
-
DateTime
public DateTime(java.lang.String dateTime) throws java.text.ParseExceptionCreates a XJDF DateTime instance by a String expression object.- Parameters:
dateTime- XJDF DateTime String expression. Should match the format yyyy-MM-dd'T'HH:mm:ss'Z'.- Throws:
java.text.ParseException- if the passed expression
-
DateTime
public DateTime(java.util.Date date)
Creates a XJDF DateTime instance by a Date object.- Parameters:
date- Date object.
-
-
Method Detail
-
getCalendar
public final java.util.Calendar getCalendar()
Clones the underlying calendar and returns it.- Returns:
- the cloned calendar
-
marshal
public final java.lang.String marshal(DateTime dateTime)
- Specified by:
marshalin classjakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,DateTime>- See Also:
javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
-
unmarshal
public final DateTime unmarshal(java.lang.String dateTime) throws java.lang.Exception
- Specified by:
unmarshalin classjakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,DateTime>- Throws:
java.lang.Exception- See Also:
javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
-
toString
public final java.lang.String toString()
- Specified by:
toStringin classAbstractXJdfType<java.lang.String,DateTime>- See Also:
Object.toString()
-
toString
public final java.lang.String toString(java.util.TimeZone timeZone)
Formats this DateTime object using the passed time zone.- Parameters:
timeZone- The time zone to use.- Returns:
- String representation based for the passed time zone.
-
-