Package org.simpleframework.xml.strategy
Class Allocate
- java.lang.Object
-
- org.simpleframework.xml.strategy.Allocate
-
- All Implemented Interfaces:
Value
class Allocate extends java.lang.Object implements Value
TheAllocate
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 java.lang.String
key
This is the unique key that is used to store the value.private java.util.Map
map
This is used to store each instance in the object graph.private Value
value
This is used to create an instance of the specified type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getLength()
This returns the length of an array if this value represents an array.java.lang.Class
getType()
This is the type of the object instance that will be created and set on this value.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 object)
This method is used to set the provided object in to the graph so that it can later be retrieved.
-
-
-
Field Detail
-
value
private Value value
This is used to create an instance of the specified type.
-
key
private java.lang.String key
This is the unique key that is used to store the value.
-
map
private java.util.Map map
This is used to store each instance in the object graph.
-
-
Constructor Detail
-
Allocate
public Allocate(Value value, java.util.Map map, java.lang.String key)
Constructor for theAllocate
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 instancemap
- this contains each instance mapped with a keykey
- this is the unique key representing this instance
-
-
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 object is not set in the graph then this will return null.
-
setValue
public void setValue(java.lang.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.
-
getType
public java.lang.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.
-
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.
-
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 interfaceValue
- Returns:
- this returns false for each type encountered
-
-