Class MCRMetaBoolean

java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaBoolean
All Implemented Interfaces:
Cloneable, MCRMetaInterface

public final class MCRMetaBoolean extends MCRMetaDefault
This class implements all method for handling with the MCRMetaBoolean part of a metadata object. The MCRMetaBoolean class present a logical value of true or false and optional a type.

<tag class="MCRMetaBoolean" heritable="...">
<subtag type="...">
true|false
</subtag>
</tag>

Author:
Jens Kupferschmidt
  • Constructor Details

    • MCRMetaBoolean

      public MCRMetaBoolean()
      This is the constructor.
      The language element was set to en . The boolean value was set to false.
    • MCRMetaBoolean

      @Deprecated public MCRMetaBoolean(String subtag, String lang, String type, int inherted, String value) throws MCRException
      Deprecated.
      This is the constructor.
      The language element was set to en . 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 boolean string value was set to a boolean element, if it is null, false was set.
      Parameters:
      subtag - the name of the subtag
      lang - the language
      type - the optional type string
      inherted - a value >= 0
      value - the boolean value (true or false) as string
      Throws:
      MCRException - if the subtag value is null or empty
    • MCRMetaBoolean

      public MCRMetaBoolean(String subtag, String type, int inherted, String value) throws MCRException
      This is the constructor.
      The language element was set to en . 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 boolean string value was set to a boolean element, if it is null, false was set.
      Parameters:
      subtag - the name of the subtag
      type - the optional type string
      inherted - a value >= 0
      value - the boolean value (true or false) as string
      Throws:
      MCRException - if the subtag value is null or empty
    • MCRMetaBoolean

      public MCRMetaBoolean(String subtag, String type, int inherted, boolean value) throws MCRException
      This is the constructor.
      The language element was set to en . 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 boolean string value was set to a boolean element, if it is null, false was set.
      Parameters:
      subtag - the name of the subtag
      type - the optional type string
      inherted - a value >= 0
      value - the boolean value (true or false)
      Throws:
      MCRException - if the subtag value is null or empty
  • Method Details

    • setValue

      public void setValue(String value)
      This method set value. It set false if the string is corrupt.
      Parameters:
      value - the boolean value (true or false) as string
    • setValue

      public void setValue(boolean value)
      This method set the value.
      Parameters:
      value - the boolean value
    • getValue

      public boolean getValue()
      This method get the value element.
      Returns:
      the value as Boolean
    • getValueToString

      public String getValueToString()
      This method get the value element as String.
      Returns:
      the value as String
    • 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 MCRMetaDefault
      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 MCRBoolean definition for the given subtag.
      Specified by:
      createXML in interface MCRMetaInterface
      Overrides:
      createXML in class MCRMetaDefault
      Returns:
      a JDOM Element with the XML MCRBoolean 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 MCRMetaDefault.createJSON() method with the following data.
         {
           value: true|false
         }
       
      Specified by:
      createJSON in interface MCRMetaInterface
      Overrides:
      createJSON in class MCRMetaDefault
      Returns:
      a GSON object containing the json data of the metadata part
    • clone

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

      public void debug()
      This method put debug data to the logger (for the debug mode).
      Specified by:
      debug in interface MCRMetaInterface
      Overrides:
      debug in class MCRMetaDefault
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class MCRMetaDefault