Package org.mycore.datamodel.metadata
Class MCRMetaISO8601Date
java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaISO8601Date
- All Implemented Interfaces:
Cloneable
,MCRMetaInterface
provides support for a restricted range of formats, all of which are valid
ISO 8601 dates and times.
The range of supported formats is exactly the same range that is suggested by
the W3C datetime profile in
its version from 1997-09-15.
- Since:
- 1.3
- Version:
- $Revision$ $Date$
- Author:
- Thomas Scheffler (yagee)
-
Field Summary
Fields inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
datapart, DEFAULT_ATTRIBUTE_INHERITED, DEFAULT_ATTRIBUTE_LANG, DEFAULT_ATTRIBUTE_SEQUENCE, DEFAULT_ATTRIBUTE_TYPE, DEFAULT_ELEMENT_DATAPART, DEFAULT_INHERITED, DEFAULT_LANG_LENGTH, DEFAULT_LANGUAGE, DEFAULT_SEQUENCE, DEFAULT_STRING_LENGTH, DEFAULT_TYPE_LENGTH, inherited, lang, NL, sequence, subtag, type
-
Constructor Summary
ConstructorDescriptionconstructs a empty instance.MCRMetaISO8601Date
(String subtag, String type, int inherted) same as superImplentation but sets lang attribute to "null" -
Method Summary
Modifier and TypeMethodDescriptionclone()
clone of this instance you will get a (deep) clone of this elementcom.google.gson.JsonObject
Creates the JSON representation.This abstract method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMeta... definition for the given subtag.void
debug()
This method put debug data to the logger (for the debug mode).boolean
getDate()
returns the Date representing this element.returns a ISO 8601 conform String using the current set format.Returns the internal date.protected static Namespace
getNs()
returns the namespace of this elementvoid
sets the date for this meta data objectvoid
sets the date for this meta data objectvoid
sets the input and output format.void
setFromDOM
(Element element) This method read the XML input stream part from a DOM part for the metadata of the document.void
validate()
Validates this MCRMetaISO8601Date.Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
debugDefault, decrementInherited, getInherited, getLang, getSequence, getSubTag, getType, hashCode, incrementInherited, isValid, setInherited, setLang, setSequence, setSubTag, setType
-
Constructor Details
-
MCRMetaISO8601Date
public MCRMetaISO8601Date()constructs a empty instance.- See Also:
-
MCRMetaISO8601Date
same as superImplentation but sets lang attribute to "null"
-
-
Method Details
-
createXML
Description copied from class:MCRMetaDefault
This abstract method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMeta... definition for the given subtag.- Specified by:
createXML
in interfaceMCRMetaInterface
- Overrides:
createXML
in classMCRMetaDefault
- Returns:
- a JDOM Element with the XML MCRMeta... part
- Throws:
MCRException
- if the content of this class is not valid
-
createJSON
public com.google.gson.JsonObject createJSON()Creates the JSON representation. Extends theMCRMetaDefault.createJSON()
method with the following data.{ date: "2016-02-08", format: "YYYY-MM-DD" }
- Specified by:
createJSON
in interfaceMCRMetaInterface
- Overrides:
createJSON
in classMCRMetaDefault
- Returns:
- a GSON object containing the json data of the metadata part
-
setFromDOM
Description copied from class:MCRMetaDefault
This method read the XML input stream part from a DOM part for the metadata of the document.- Specified by:
setFromDOM
in interfaceMCRMetaInterface
- Overrides:
setFromDOM
in classMCRMetaDefault
- Parameters:
element
- a relevant DOM element for the metadata
-
getNs
returns the namespace of this element- Returns:
- Returns the ns.
-
setDate
sets the date for this meta data object- Parameters:
isoString
- Date in any form that is a valid W3C dateTime
-
getDate
returns the Date representing this element.- Returns:
- a new Date instance of the time set in this element
-
setDate
sets the date for this meta data object- Parameters:
dt
- Date object representing date String in Element
-
getISOString
returns a ISO 8601 conform String using the current set format.- Returns:
- date in ISO 8601 format, or null if date is unset.
-
setFormat
sets the input and output format. please use only the formats defined on the W3C Page, which are also exported as static fields by this class.- Parameters:
format
- a format string that is valid conforming to xsd:duration schema type.
-
getFormat
-
getMCRISO8601Date
Returns the internal date.- Returns:
- the base date
-
debug
public void debug()This method put debug data to the logger (for the debug mode).- Specified by:
debug
in interfaceMCRMetaInterface
- Overrides:
debug
in classMCRMetaDefault
-
clone
clone of this instance you will get a (deep) clone of this element- Specified by:
clone
in interfaceMCRMetaInterface
- Overrides:
clone
in classMCRMetaDefault
- See Also:
-
validate
Validates this MCRMetaISO8601Date. This method throws an exception if:- the subtag is not null or empty
- the lang value was supported
- the inherited value is lower than zero
- the isoDate or the temporal accessor is null
- Specified by:
validate
in interfaceMCRMetaInterface
- Overrides:
validate
in classMCRMetaDefault
- Throws:
MCRException
- the MCRMetaISO8601Date is invalid
-
equals
- Overrides:
equals
in classMCRMetaDefault
-