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(int year, int month, int day, int hour, int minute, int second, int millis, java.time.ZoneId zoneId)Custom constructor.DateTime(long epochMillis)Creates a XJDF DateTime instance by a Date object.DateTime(java.lang.String dateTime)Creates a XJDF DateTime instance by a String expression object.DateTime(java.time.ZonedDateTime zonedDateTime)Custom constructor.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.time.ZonedDateTimegetZonedDateTime()Returns the zoned date time object representing the date times value.java.lang.Stringmarshal(DateTime dateTime)longtoEpochMillis()Returns the DateTime value as epoch millis.java.lang.StringtoString()java.lang.StringtoString(java.time.ZoneId zoneId)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(java.time.ZonedDateTime zonedDateTime)
Custom constructor. Accepting a ZonedDateTime object for initializing.
-
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(int year, int month, int day, int hour, int minute, int second, int millis, java.time.ZoneId zoneId)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.millis- The value used to set the MILLISECONDSzoneId- The zone id.
-
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.
-
DateTime
public DateTime(long epochMillis)
Creates a XJDF DateTime instance by a Date object.- Parameters:
epochMillis- Epoch millis.
-
-
Method Detail
-
getCalendar
public final java.util.Calendar getCalendar()
Clones the underlying calendar and returns it.- Returns:
- the cloned calendar
-
toEpochMillis
public final long toEpochMillis()
Returns the DateTime value as epoch millis.- Returns:
- The DateTime value as epoch millis.
-
getZonedDateTime
public final java.time.ZonedDateTime getZonedDateTime()
Returns the zoned date time object representing the date times value.- Returns:
- The ZonedDateTime object.
-
marshal
public final java.lang.String marshal(DateTime dateTime)
- Specified by:
marshalin classjakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,DateTime>- See Also:
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:
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.time.ZoneId zoneId)
- See Also:
Object.toString()
-
-