Class ByteArrayValue

  • All Implemented Interfaces:
    Value

    public class ByteArrayValue
    extends java.lang.Object
    implements Value
    ByteArrayValue is not immutable.
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteArrayValue​(byte[] value)
      Create a new ByteArrayValue whose internal byte array will be a reference to the value passed to this constructor.
      ByteArrayValue​(byte[] value, boolean copy)
      Creates a new ByteArrayValue copying the byte array passed if copy is true.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean asBoolean()
      Returns the value as a boolean.
      byte asByte()
      Returns the value as a byte.
      byte[] asByteArray()
      Returns the value as a byte array.
      double asDouble()
      Returns the value as a double.
      float asFloat()
      Returns the value as a float.
      int asInt()
      Returns the value as an integer.
      long asLong()
      Returns the value as a long.
      short asShort()
      Returns the value as a short.
      java.lang.String asString()
      Returns the value as a string.
      ValueType getValueType()
      Returns the ValueType
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ByteArrayValue

        public ByteArrayValue​(byte[] value)
        Create a new ByteArrayValue whose internal byte array will be a reference to the value passed to this constructor. That means the passed byte array is not copied. Therefore you should not change the contents of value after calling this constructor. If you want ByteArrayValue to internally store a copy of the passed value then you should use the other constructor of this class instead.
        Parameters:
        value - the byte array value.
      • ByteArrayValue

        public ByteArrayValue​(byte[] value,
                              boolean copy)
        Creates a new ByteArrayValue copying the byte array passed if copy is true.
        Parameters:
        value - the byte array value.
        copy - if true it will internally store a copy of value, else it will store a reference to value.
    • Method Detail

      • asDouble

        public double asDouble()
        Description copied from interface: Value
        Returns the value as a double.
        Specified by:
        asDouble in interface Value
        Returns:
        the value as a double
      • asFloat

        public float asFloat()
        Description copied from interface: Value
        Returns the value as a float.
        Specified by:
        asFloat in interface Value
        Returns:
        the value as a float
      • asLong

        public long asLong()
        Description copied from interface: Value
        Returns the value as a long.
        Specified by:
        asLong in interface Value
        Returns:
        the value as a long
      • asInt

        public int asInt()
        Description copied from interface: Value
        Returns the value as an integer.
        Specified by:
        asInt in interface Value
        Returns:
        the value as an integer
      • asShort

        public short asShort()
        Description copied from interface: Value
        Returns the value as a short.
        Specified by:
        asShort in interface Value
        Returns:
        the value as a short
      • asByte

        public byte asByte()
        Description copied from interface: Value
        Returns the value as a byte.
        Specified by:
        asByte in interface Value
        Returns:
        the value as a byte
      • asBoolean

        public boolean asBoolean()
        Description copied from interface: Value
        Returns the value as a boolean.
        Specified by:
        asBoolean in interface Value
        Returns:
        the value as a boolean
      • asByteArray

        public byte[] asByteArray()
        Description copied from interface: Value
        Returns the value as a byte array.
        Specified by:
        asByteArray in interface Value
        Returns:
        the value as a byte array
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • asString

        public java.lang.String asString()
        Description copied from interface: Value
        Returns the value as a string.
        Specified by:
        asString in interface Value
        Returns:
        the value as a string