Interface XmlValue

All Superinterfaces:
Serializable
All Known Subinterfaces:
XmlDocument, XmlElement
All Known Implementing Classes:
SimpleDocument, SimpleElement, SimpleValue

public interface XmlValue extends Serializable
An interface for XML element content and element attribute values.
Author:
cp 2000.10.18
  • Field Details

  • Method Details

    • getBoolean

      boolean getBoolean()
      Get the value as a boolean.
      Returns:
      the value as a boolean
    • setBoolean

      void setBoolean(boolean fVal)
      Set the boolean value.
      Parameters:
      fVal - a new value of type boolean
    • getInt

      int getInt()
      Get the value as an int.
      Returns:
      the value as an int
    • setInt

      void setInt(int nVal)
      Set the int value.
      Parameters:
      nVal - a new value of type int
    • getLong

      long getLong()
      Get the value as a long.
      Returns:
      the value as a long
    • setLong

      void setLong(long lVal)
      Set the long value.
      Parameters:
      lVal - a new value of type long
    • getDouble

      double getDouble()
      Get the value as a double.
      Returns:
      the value as a double
    • setDouble

      void setDouble(double dflVal)
      Set the double value.
      Parameters:
      dflVal - a new value of type double
    • getDecimal

      BigDecimal getDecimal()
      Get the value as a decimal.
      Returns:
      the value as a BigDecimal
    • setDecimal

      void setDecimal(BigDecimal decVal)
      Set the dcimal value.
      Parameters:
      decVal - a new value of type BigDecimal
    • getString

      String getString()
      Get the value as a String.
      Returns:
      the value as a String
    • setString

      void setString(String sVal)
      Set the String value.
      Parameters:
      sVal - a new value of type String
    • getBinary

      Binary getBinary()
      Get the value as binary. The XML format is expected to be Base64.
      Returns:
      the value as a Binary object
    • setBinary

      void setBinary(Binary binVal)
      Set the binary value.
      Parameters:
      binVal - a new value of type Binary
    • getDate

      Date getDate()
      Get the value as a Date.
      Returns:
      the value as a Date
    • setDate

      void setDate(Date dtVal)
      Set the Date value.
      Parameters:
      dtVal - a new value of type Date
    • getTime

      Time getTime()
      Get the value as a Time.
      Returns:
      the value as a Time
    • setTime

      void setTime(Time dtVal)
      Set the Time value.
      Parameters:
      dtVal - a new value of type Time
    • getDateTime

      Timestamp getDateTime()
      Get the value as a Timestamp.
      Returns:
      the value as a Timestamp
    • setDateTime

      void setDateTime(Timestamp dtVal)
      Set the Timestamp value.
      Parameters:
      dtVal - a new value of type Timestamp
    • getBoolean

      boolean getBoolean(boolean fDefault)
      Get the value as a boolean.
      Parameters:
      fDefault - the default return value if the internal value can not be translated into a legal value of type boolean
      Returns:
      the value as a boolean
    • getInt

      int getInt(int nDefault)
      Get the value as an int.
      Parameters:
      nDefault - the default return value if the internal value can not be translated into a legal value of type int
      Returns:
      the value as an int
    • getLong

      long getLong(long lDefault)
      Get the value as a long.
      Parameters:
      lDefault - the default return value if the internal value can not be translated into a legal value of type long
      Returns:
      the value as a long
    • getDouble

      double getDouble(double dflDefault)
      Get the value as a double.
      Parameters:
      dflDefault - the default return value if the internal value can not be translated into a legal value of type double
      Returns:
      the value as a double
    • getDecimal

      BigDecimal getDecimal(BigDecimal decDefault)
      Get the value as a decimal.
      Parameters:
      decDefault - the default return value if the internal value can not be translated into a legal value of type decimal
      Returns:
      the value as a decimal
    • getString

      String getString(String sDefault)
      Get the value as a String.
      Parameters:
      sDefault - the default return value if the internal value can not be translated into a legal value of type String
      Returns:
      the value as a String
    • getBinary

      Binary getBinary(Binary binDefault)
      Get the value as binary. The XML format is expected to be Base64.
      Parameters:
      binDefault - the default return value if the internal value can not be translated into a legal value of type Binary
      Returns:
      the value as a Binary object
    • getDate

      Date getDate(Date dtDefault)
      Get the value as a Date.
      Parameters:
      dtDefault - the default return value if the internal value can not be translated into a legal value of type Date
      Returns:
      the value as a Date
    • getTime

      Time getTime(Time dtDefault)
      Get the value as a Time.
      Parameters:
      dtDefault - the default return value if the internal value can not be translated into a legal value of type Time
      Returns:
      the value as a Time
    • getDateTime

      Timestamp getDateTime(Timestamp dtDefault)
      Get the value as a Timestamp.
      Parameters:
      dtDefault - the default return value if the internal value can not be translated into a legal value of type Timestamp
      Returns:
      the value as a Timestamp
    • getValue

      Object getValue()
      Get the value as an Object. The following types are supported: Boolean Integer Long Double BigDecimal String Binary Date Time Timestamp It is always legal for an implementation to return the value as a String, for example returning a binary value in a base64 encoding. This method exists to allow one value to copy from another value.
      Returns:
      the value as an Object or null if the XmlValue does not have a value; attributes never have a null value
    • getParent

      XmlElement getParent()
      Get the parent element of this value.
      Returns:
      the parent element, or null if this value has no parent
    • setParent

      void setParent(XmlElement element)
      Set the parent element of this value. The parent can not be modified once set.
      Parameters:
      element - the parent element
      Throws:
      IllegalArgumentException - thrown if the specified parent is null
      IllegalStateException - throw if the parent is already set
    • isEmpty

      boolean isEmpty()
      Determine if the value is empty.
      Returns:
      true if the value is empty
    • isAttribute

      boolean isAttribute()
      Determine if this value is an element attribute.
      Returns:
      true if this value is an element attribute, otherwise false
    • isContent

      boolean isContent()
      Determine if this value is an element's content.
      Returns:
      true if this value is an element's content, otherwise false
    • isMutable

      boolean isMutable()
      Determine if this value can be modified. If the value can not be modified, all mutating methods are required to throw an UnsupportedOperationException.
      Returns:
      true if this value can be modified, otherwise false to indicate that this value is read-only
    • writeValue

      void writeValue(PrintWriter out, boolean fPretty)
      Write the value as it will appear in XML.
      Parameters:
      out - a PrintWriter object to use to write to
      fPretty - true to specify that the output is intended to be as human readable as possible
    • toString

      String toString()
      Format the XML value into a String in a display format.
      Overrides:
      toString in class Object
      Returns:
      a String representation of the XML value
    • hashCode

      int hashCode()
      Provide a hash value for this XML value. The hash value is defined as one of the following:
      1. 0 if getValue() returns null
      2. otherwise the hash value is the hashCode() of the string representation of the value
      Overrides:
      hashCode in class Object
      Returns:
      the hash value for this XML value
    • equals

      boolean equals(Object o)
      Compare this XML value with another XML value for equality.
      Overrides:
      equals in class Object
      Returns:
      true if the values are equal, false otherwise
    • clone

      Object clone()
      Creates and returns a copy of this SimpleValue. The returned copy is "unlinked" from the parent and mutable
      Returns:
      a clone of this instance.