Class ArrayValue

  • All Implemented Interfaces:
    Value

    class ArrayValue
    extends java.lang.Object
    implements Value
    The ArrayValue object is a value used for describing arrays for a specified component type object. This provides the component type for the array as well as the length of the array, which allows the deserialization process to build a suitable length array from the criteria taken from the XML element.
    See Also:
    Allocate
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int size
      This is used to determine the size of the array to be created.
      private java.lang.Class type
      This is the optional field type for the array to be created.
      private java.lang.Object value
      This is the value that has been set within this value object.
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayValue​(java.lang.Class type, int size)
      Constructor for the ArrayValue object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLength()
      This returns the length of the array that is to be allocated.
      java.lang.Class getType()
      This will return the component type for the array instance that is described by this object.
      java.lang.Object getValue()
      This is the instance that is acquired from this value.
      boolean isReference()
      This will return false for the array value because the array is not a reference type.
      void setValue​(java.lang.Object value)
      This method is set the value so that future calls provide the value that was provided.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • value

        private java.lang.Object value
        This is the value that has been set within this value object.
      • type

        private java.lang.Class type
        This is the optional field type for the array to be created.
      • size

        private int size
        This is used to determine the size of the array to be created.
    • Constructor Detail

      • ArrayValue

        public ArrayValue​(java.lang.Class type,
                          int size)
        Constructor for the ArrayValue object. This will provide sufficient criteria to the deserialization process to instantiate an array of the specified size an type.
        Parameters:
        type - this is the component type for the array
        size - this is the size of the array to instantiate
    • Method Detail

      • getValue

        public java.lang.Object getValue()
        This is the instance that is acquired from this value. This is typically used if the isReference method is true. If there was no value reference provided then this returns null.
        Specified by:
        getValue in interface Value
        Returns:
        this returns a reference to an existing array
      • setValue

        public void setValue​(java.lang.Object value)
        This method is set the value so that future calls provide the value that was provided. Setting the value ensures that the value used is consistent across invocations of this object.
        Specified by:
        setValue in interface Value
        Parameters:
        value - this is the value to inserted to this object
      • getType

        public java.lang.Class getType()
        This will return the component type for the array instance that is described by this object. This is used to ensure that an array with the correct component type can be instantiated.
        Specified by:
        getType in interface Value
        Returns:
        this returns the component type for the array
      • getLength

        public int getLength()
        This returns the length of the array that is to be allocated. For various Strategy implementations the length is provided as an attribute on the array XML element.
        Specified by:
        getLength in interface Value
        Returns:
        this returns the number of elements for the array
      • isReference

        public boolean isReference()
        This will return false for the array value because the array is not a reference type. Only Reference values will have this set to true as they read from the graph.
        Specified by:
        isReference in interface Value
        Returns:
        this returns false as this is not a reference value