Class HexBinaryValue

All Implemented Interfaces:
Serializable, Expression, Item, ValueRepresentation

public class HexBinaryValue extends AtomicValue
A value of type xs:hexBinary
See Also:
  • Constructor Details

    • HexBinaryValue

      public HexBinaryValue(CharSequence in) throws XPathException
      Constructor: create a hexBinary value from a supplied string, in which each octet is represented by a pair of values from 0-9, a-f, A-F
      Throws:
      XPathException
    • HexBinaryValue

      public HexBinaryValue(byte[] value)
      Constructor: create a hexBinary value from a given array of bytes
  • Method Details

    • getBinaryValue

      public byte[] getBinaryValue()
      Get the binary value
    • convertPrimitive

      public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
      Convert to target data type
      Specified by:
      convertPrimitive in class AtomicValue
      Parameters:
      requiredType - an integer identifying the required atomic type
      validate - true if validation is required. If set to false, the caller guarantees that the value is valid for the target data type, and that further validation is therefore not required. Note that a validation failure may be reported even if validation was not requested.
      context -
      Returns:
      an AtomicValue, a value of the required type; or an ErrorValue
    • getStringValue

      public String getStringValue()
      Convert to string
      Specified by:
      getStringValue in interface Item
      Specified by:
      getStringValue in interface ValueRepresentation
      Specified by:
      getStringValue in class AtomicValue
      Returns:
      the canonical representation.
      See Also:
    • getItemType

      public ItemType getItemType(TypeHierarchy th)
      Determine the data type of the exprssion
      Specified by:
      getItemType in interface Expression
      Overrides:
      getItemType in class Value
      Parameters:
      th -
      Returns:
      Type.HEX_BINARY_TYPE
    • getLengthInOctets

      public int getLengthInOctets()
      Get the number of octets in the value
    • convertToJava

      public Object convertToJava(Class target, XPathContext context) throws XPathException
      Convert to Java object (for passing to external functions)
      Overrides:
      convertToJava in class Value
      Throws:
      XPathException
    • equals

      public boolean equals(Object other)
      Test if the two hexBinary values are equal.
      Overrides:
      equals in class Value
    • hashCode

      public int hashCode()
      Description copied from class: Value
      Return a hash code to support the equals() function
      Overrides:
      hashCode in class Value