Class MCRMetaDateLangText

All Implemented Interfaces:
Cloneable, MCRMetaInterface

public class MCRMetaDateLangText extends MCRMetaLangText
This class implements all method for handling with the MCRMetaDateLangText part of a metadata object. The MCRMetaDateLangText class present a single item, which has quadruples of a text and his corresponding language and optional a type and date.
Version:
$Revision$ $Date$
  • Field Details

  • Constructor Details

    • MCRMetaDateLangText

      public MCRMetaDateLangText()
      This is the constructor.
      The language element was set to en . All other elements was set to an empty string. The form Attribute is set to 'plain'.
    • MCRMetaDateLangText

      public MCRMetaDateLangText(String subtag, String lang, String type, int inherted, String form, String text) throws MCRException
      This is the constructor.
      The language element was set. If the value of lang is null, empty or false en was set. The subtag element was set to the value of subtag. If the value of subtag is null or empty an exception was thrown. The type element was set to the value of type, if it is null, an empty string was set to the type element. The text element was set to the value of text, if it is null, an empty string was set to the text element.
      Parameters:
      subtag - the name of the subtag
      lang - the default language
      type - the optional type string
      inherted - a value >= 0
      form - the format string, if it is empty 'plain' is set.
      text - the text string
      Throws:
      MCRException - if the subtag value is null or empty
  • Method Details

    • setDate

      public void setDate(MCRISO8601Date isoDate)
      sets the date for this meta data object
      Parameters:
      isoDate - the new date, may be null
    • getDate

      public MCRISO8601Date getDate()
      Returns the date.
      Returns:
      the date, may be null
    • setFromDOM

      public void setFromDOM(Element element)
      This method read the XML input stream part from a DOM part for the metadata of the document.
      Specified by:
      setFromDOM in interface MCRMetaInterface
      Overrides:
      setFromDOM in class MCRMetaLangText
      Parameters:
      element - a relevant JDOM element for the metadata
    • createXML

      public Element createXML() throws MCRException
      This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaLangText definition for the given subtag.
      Specified by:
      createXML in interface MCRMetaInterface
      Overrides:
      createXML in class MCRMetaLangText
      Returns:
      a JDOM Element with the XML MCRMetaLangText part
      Throws:
      MCRException - if the content of this class is not valid
    • createJSON

      public com.google.gson.JsonObject createJSON()
      Creates the JSON representation. Extends the MCRMetaLangText.createJSON() method with the following data.
         {
           text: "Hallo Welt",
           form: "plain",
           date: "2000-01-01",
           format: "YYYY-MM-DD"
         }
       
      Specified by:
      createJSON in interface MCRMetaInterface
      Overrides:
      createJSON in class MCRMetaLangText
      Returns:
      a GSON object containing the json data of the metadata part
    • clone

      public MCRMetaDateLangText clone()
      clone of this instance you will get a (deep) clone of this element
      Specified by:
      clone in interface MCRMetaInterface
      Overrides:
      clone in class MCRMetaLangText
      See Also:
    • equals

      public boolean equals(Object obj)
      Check the equivalence between this instance and the given object.
      Overrides:
      equals in class MCRMetaLangText
      Parameters:
      obj - the MCRMetaDateLangText object
      Returns:
      true if its equal