Class Allocate

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

class Allocate extends Object implements Value
The Allocate object is used to represent an entity that has not yet been created and needs to be allocated to the the object graph. This is given a map that contains each node in the graph keyed via a unique identifier. When an instance is created and set then it is added to the object graph.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    This is the unique key that is used to store the value.
    private Map
    This is used to store each instance in the object graph.
    private Value
    This is used to create an instance of the specified type.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Allocate(Value value, Map map, String key)
    Constructor for the Allocate object.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This returns the length of an array if this value represents an array.
    This is the type of the object instance that will be created and set on this value.
    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
    setValue(Object object)
    This method is used to set the provided object in to the graph so that it can later be retrieved.

    Methods inherited from class java.lang.Object

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

    • value

      private Value value
      This is used to create an instance of the specified type.
    • key

      private String key
      This is the unique key that is used to store the value.
    • map

      private Map map
      This is used to store each instance in the object graph.
  • Constructor Details

    • Allocate

      public Allocate(Value value, Map map, String key)
      Constructor for the Allocate object. This is used to create a value that can be used to set any object in to the internal object graph so references can be discovered.
      Parameters:
      value - this is the value used to describe the instance
      map - this contains each instance mapped with a key
      key - this is the unique key representing this instance
  • 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 object is not set in the graph then this will return null.
      Specified by:
      getValue in interface Value
      Returns:
      an instance of the type this object represents
    • setValue

      public void setValue(Object object)
      This method is used to set the provided object in to the graph so that it can later be retrieved. If the key for this value is null then no object is set in the object graph.
      Specified by:
      setValue in interface Value
      Parameters:
      object - this is the value to insert to the graph
    • getType

      public Class getType()
      This is the type of the object instance that will be created and set on this value. If this represents an array then this is the component type for the array to be created.
      Specified by:
      getType in interface Value
      Returns:
      the type of the object that will be instantiated
    • getLength

      public int getLength()
      This returns the length of an array if this value represents an array. If this does not represent an array then this will return zero. It is up to the deserialization process to determine if the annotated field or method is an array.
      Specified by:
      getLength in interface Value
      Returns:
      this returns the length of the array object
    • 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