Class ObjectValue

java.lang.Object
org.simpleframework.xml.strategy.ObjectValue
All Implemented Interfaces:
Value

class ObjectValue extends 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:
  • Field Summary

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

    Constructors
    Constructor
    Description
    Constructor for the ObjectValue object.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This returns zero as this is an object and will typically not be used to instantiate anything.
    This is the type of the object instance this represents.
    This method is used to acquire an instance of the type that is defined by this object.
    boolean
    This method always returns false for the default type.
    void
    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 Details

    • value

      private Object value
      This is the value that has been set for this instance.
    • type

      private Class type
      This is the type that this object is used to represent.
  • Constructor Details

    • ObjectValue

      public ObjectValue(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 Details

    • getValue

      public 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(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 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