Class ObjectValue

  • All Implemented Interfaces:
    Value

    class ObjectValue
    extends java.lang.Object
    implements Value
    The ObjectValue is an implementation of a value that represents a object other than an array. Objects described by this can be instantiated and set in to the internal graph so that they can be later retrieved.
    See Also:
    Allocate
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class type
      This is the type that this object is used to represent.
      private java.lang.Object value
      This is the value that has been set for this instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectValue​(java.lang.Class type)
      Constructor for the ObjectValue object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLength()
      This returns zero as this is an object and will typically not be used to instantiate anything.
      java.lang.Class getType()
      This is the type of the object instance this represents.
      java.lang.Object getValue()
      This method is used to acquire an instance of the type that is defined by this object.
      boolean isReference()
      This method always returns false for the default type.
      void setValue​(java.lang.Object value)
      This method is used set the value within this object.
      • 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 for this instance.
      • type

        private java.lang.Class type
        This is the type that this object is used to represent.
    • Constructor Detail

      • ObjectValue

        public ObjectValue​(java.lang.Class type)
        Constructor for the ObjectValue object. This is used to describe an object that can be instantiated by the deserialization process and set on the internal graph used.
        Parameters:
        type - this is the type of object that is described
    • Method Detail

      • getValue

        public java.lang.Object getValue()
        This method is used to acquire an instance of the type that is defined by this object. If the value has not been set then this method will return null as this is not a reference.
        Specified by:
        getValue in interface Value
        Returns:
        an instance of the type this object represents
      • setValue

        public void setValue​(java.lang.Object value)
        This method is used set the value within this object. Once this is set then the getValue method will return the object that has been provided for consistency.
        Specified by:
        setValue in interface Value
        Parameters:
        value - this is the value to insert as the type
      • getType

        public java.lang.Class getType()
        This is the type of the object instance this represents. The type returned by this is used to instantiate an object which will be set on this value and the internal graph maintained.
        Specified by:
        getType in interface Value
        Returns:
        the type of the object that will be instantiated
      • getLength

        public int getLength()
        This returns zero as this is an object and will typically not be used to instantiate anything. If the reference is an an array then this can not be used to instantiate it.
        Specified by:
        getLength in interface Value
        Returns:
        this returns zero regardless of the value type
      • isReference

        public boolean isReference()
        This method always returns false for the default type. This is because by default all elements encountered within the XML are to be deserialized based on there XML annotations.
        Specified by:
        isReference in interface Value
        Returns:
        this returns false for each type encountered