Package org.apache.sis.internal.jaxb.gco
Class GO_DateTime
java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<GO_DateTime,Date>
org.apache.sis.internal.jaxb.gco.GO_DateTime
- Direct Known Subclasses:
GO_DateTime.Since2014
JAXB adapter wrapping the date value in a
<gco:Date>
or <gco:DateTime>
element,
for ISO 19115-3 compliance. Only one of Date
or DateTime
field shall be non-null.
At marshalling time, the choice is performed depending on whatever the given date contains
hour, minute or seconds information different than zero.
Difference between ISO 19139:2007 and ISO 19115-3:2016
The ISObaseTypes.xsd
files define two kinds of date property:
gco:Date_PropertyType
accepts eithergco:Date
orgco:DateTime
.gco:DateTime_PropertyType
accepts onlygco:DateTime
.
Date_PropertyType
. But in the new standard (ISO 19115-3:2016), most date properties are of
type DateTime_PropertyType
, i.e. gco:Date
is not legal anymore. The only exception
is versionDate
in cat:AbstractCT_Catalogue
.- Since:
- 0.3
- Version:
- 1.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Wraps the value only if marshalling ISO 19115-3 element. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate XMLGregorianCalendar
The date value using the"Date"
name, used when there are no hours, minutes or seconds to format.private XMLGregorianCalendar
The date and time value using thecode "DateTime"
name. -
Constructor Summary
ConstructorsModifierConstructorDescriptionEmpty constructor for JAXB.private
GO_DateTime
(Date date) Builds a wrapper for the givenDate
. -
Method Summary
-
Field Details
-
dateTime
The date and time value using thecode "DateTime"
name. Only one ofdate
anddateTime
shall be non-null. -
date
The date value using the"Date"
name, used when there are no hours, minutes or seconds to format.
-
-
Constructor Details
-
GO_DateTime
public GO_DateTime()Empty constructor for JAXB. -
GO_DateTime
Builds a wrapper for the givenDate
.- Parameters:
date
- the date to marshal. Cannot benull
.
-
-
Method Details
-
getDate
Returns the current date, ornull
if none. If both fields are defined, thendateTime
has precedence since it is assumed more accurate. -
unmarshal
Converts a date read from a XML stream to the object which will contain the value. JAXB calls automatically this method at unmarshalling time.- Specified by:
unmarshal
in classXmlAdapter<GO_DateTime,
Date> - Parameters:
value
- the adapter for this metadata value.- Returns:
- a date which represents the metadata value.
-
marshal
Converts the date to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time. The use of<gco:Date>
or<gco:DateTime>
is determined automatically.- Specified by:
marshal
in classXmlAdapter<GO_DateTime,
Date> - Parameters:
value
- the date value.- Returns:
- the adapter for this date.
-