java.lang.Object
org.apache.jena.datatypes.xsd.AbstractDateTime
org.apache.jena.datatypes.xsd.XSDDateTime
- All Implemented Interfaces:
Comparable<AbstractDateTime>
Represent an XSD date/time value. Rather than have a separate type for each
legal date/time value combination this is a combination type than does runtime
checks whether a given field is legal in the current circumstances.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final short
Mask to indicate whether day is presentstatic final short
Mask to indicate all date/time are presentstatic final short
Mask to indicate whether month is presentstatic final short
Mask to indicate whether time is presentstatic final short
Mask to indicate whether year is presentFields inherited from class org.apache.jena.datatypes.xsd.AbstractDateTime
EQUAL, GREATER_THAN, INDETERMINATE, LESS_THAN
-
Constructor Summary
ConstructorsConstructorDescriptionXSDDateTime
(Object value, int mask) Constructor - should only be used by the internals but public scope because the internals spread across multiple packages.XSDDateTime
(Calendar date) Constructor - create a full DateTime object from a java calendar instance. -
Method Summary
Modifier and TypeMethodDescriptionReturn the date time as a java Calendar object.int
getDays()
Return the number of years in the dateTimeint
Return the number of full seconds in the dateTimeint
getHours()
Return the number of hours in the dateTimeint
Return the number of minutes in the dateTimeint
Return the month in the dateTime, this is in ISO8601 format so january = 1Return the most specific xsd type which can represent this date/timedouble
Return the number of seconds in the dateTime, including fractional partdouble
Return the time component of the dateTime - i.e. just the hours/mins/seconds, and returns the values in seconds.int
getYears()
Return the number of years in the dateTime.void
Set the mask for this date/time to be that appropriate for the given XSD subtype.Return the lexical form of the time component.toString()
Return legal serialized form.
-
Field Details
-
YEAR_MASK
public static final short YEAR_MASKMask to indicate whether year is present- See Also:
-
MONTH_MASK
public static final short MONTH_MASKMask to indicate whether month is present- See Also:
-
DAY_MASK
public static final short DAY_MASKMask to indicate whether day is present- See Also:
-
TIME_MASK
public static final short TIME_MASKMask to indicate whether time is present- See Also:
-
FULL_MASK
public static final short FULL_MASKMask to indicate all date/time are present- See Also:
-
-
Constructor Details
-
XSDDateTime
Constructor - should only be used by the internals but public scope because the internals spread across multiple packages.- Parameters:
value
- the date/time value returned by the parsingmask
- bitmask defining which components are valid in this instance (e.g. dates don't have valid time fields).
-
XSDDateTime
Constructor - create a full DateTime object from a java calendar instance.- Parameters:
date
- java calendar instance
-
-
Method Details
-
getNarrowedDatatype
Return the most specific xsd type which can represent this date/time -
narrowType
Set the mask for this date/time to be that appropriate for the given XSD subtype. If the type is a subtype of XSDdateTime the mask will be narrowed appropriately, other types will be silently ignored. -
asCalendar
Return the date time as a java Calendar object. If the timezone has been specified then the object is normalized to GMT. If the zone has not been specified then we use the default timezone.- Throws:
IllegalDateTimeFieldException
- if this is not a full date + time
-
getYears
Return the number of years in the dateTime.- Throws:
IllegalDateTimeFieldException
- if there is no legal year component
-
getMonths
Return the month in the dateTime, this is in ISO8601 format so january = 1- Throws:
IllegalDateTimeFieldException
- if there is no legal month component
-
getDays
Return the number of years in the dateTime- Throws:
IllegalDateTimeFieldException
- if there is no legal day component
-
getHours
Return the number of hours in the dateTime- Throws:
IllegalDateTimeFieldException
- if there is no legal time component
-
getMinutes
Return the number of minutes in the dateTime- Throws:
IllegalDateTimeFieldException
- if there is no legal time component
-
getFullSeconds
Return the number of full seconds in the dateTime- Throws:
IllegalDateTimeFieldException
- if there is no legal time component
-
getSeconds
Return the number of seconds in the dateTime, including fractional part- Throws:
IllegalDateTimeFieldException
- if there is no legal time component
-
getTimePart
Return the time component of the dateTime - i.e. just the hours/mins/seconds, and returns the values in seconds.- Throws:
IllegalDateTimeFieldException
- if there is no legal time component
-
toString
Return legal serialized form. -
timeLexicalForm
Return the lexical form of the time component.
-