|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simpleframework.xml.convert.RegistryStrategy
public class RegistryStrategy
The RegistryStrategy
object is used to intercept
the serialization process and delegate to custom converters. The
custom converters are resolved from a Registry
object, which is provided to the constructor. If there is no
binding for a particular object then serialization is delegated
to an internal strategy. All converters resolved by this are
instantiated once and cached internally for performance.
By default the TreeStrategy
is used to perform the
normal serialization process should there be no class binding
specifying a converter to use. However, any implementation can
be used, including the CycleStrategy
, which handles
cycles in the object graph. To specify the internal strategy to
use it can be provided in the constructor.
Registry
Constructor Summary | |
---|---|
RegistryStrategy(Registry registry)
Constructor for the RegistryStrategy object. |
|
RegistryStrategy(Registry registry,
Strategy strategy)
Constructor for the RegistryStrategy object. |
Method Summary | |
---|---|
Value |
read(Type type,
NodeMap<InputNode> node,
Map map)
This is used to read the Value which will be used
to represent the deserialized object. |
boolean |
write(Type type,
Object value,
NodeMap<OutputNode> node,
Map map)
This is used to serialize a representation of the object value provided. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RegistryStrategy(Registry registry)
RegistryStrategy
object. This
is used to create a strategy that will intercept the normal
serialization process by searching for bindings within the
provided Registry
instance.
registry
- this is the registry instance with bindingspublic RegistryStrategy(Registry registry, Strategy strategy)
RegistryStrategy
object. This
is used to create a strategy that will intercept the normal
serialization process by searching for bindings within the
provided Registry
instance.
registry
- this is the registry instance with bindingsstrategy
- this is the strategy to delegate toMethod Detail |
---|
public Value read(Type type, NodeMap<InputNode> node, Map map) throws Exception
Value
which will be used
to represent the deserialized object. If there is an binding
present then the value will contain an object instance. If it
does not then it is up to the internal strategy to determine
what the returned value contains.
read
in interface Strategy
type
- this is the type that represents a method or fieldnode
- this is the node representing the XML elementmap
- this is the session map that contain variables
Exception
- thrown if the class cannot be resolvedpublic boolean write(Type type, Object value, NodeMap<OutputNode> node, Map map) throws Exception
Registry
binding present
for the provided type then this will use the converter specified
to serialize a representation of the object. If however there
is no binding present then this will delegate to the internal
strategy. This returns true if the serialization has completed.
write
in interface Strategy
type
- this is the type that represents the field or methodvalue
- this is the object instance to be serializednode
- this is the XML element to be serialized tomap
- this is the session map used by the serializer
Exception
- thrown if the details cannot be set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |