Package org.simpleframework.xml.convert
Class Registry
- java.lang.Object
-
- org.simpleframework.xml.convert.Registry
-
public class Registry extends java.lang.ObjectTheRegistryrepresents an object that is used to register bindings between a class and a converter implementation. Converter instances created by this registry are lazily created and cached so that they are instantiated only once. This ensures that the overhead of serialization is reduced.- Author:
- Niall Gallagher
- See Also:
RegistryStrategy
-
-
Constructor Summary
Constructors Constructor Description Registry()Constructor for theRegistryobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Registrybind(java.lang.Class type, java.lang.Class converter)This is used to register a binding between a type and the converter used to serialize and deserialize it.Registrybind(java.lang.Class type, Converter converter)This is used to register a binding between a type and the converter used to serialize and deserialize it.Converterlookup(java.lang.Class type)This is used to acquire aConverterinstance from the registry.
-
-
-
Method Detail
-
lookup
public Converter lookup(java.lang.Class type) throws java.lang.Exception
This is used to acquire aConverterinstance from the registry. All instances are cache to reduce the overhead of lookups during the serialization process. Converters are lazily instantiated and so are only created if demanded.- Parameters:
type- this is the type to find the converter for- Returns:
- this returns the converter instance for the type
- Throws:
java.lang.Exception
-
bind
public Registry bind(java.lang.Class type, java.lang.Class converter) throws java.lang.Exception
This is used to register a binding between a type and the converter used to serialize and deserialize it. During the serialization process the converters are retrieved and used to convert the object members to XML.- Parameters:
type- this is the object type to bind to a converterconverter- this is the converter class to be used- Returns:
- this will return this registry instance to use
- Throws:
java.lang.Exception
-
bind
public Registry bind(java.lang.Class type, Converter converter) throws java.lang.Exception
This is used to register a binding between a type and the converter used to serialize and deserialize it. During the serialization process the converters are retrieved and used to convert the object properties to XML.- Parameters:
type- this is the object type to bind to a converterconverter- this is the converter instance to be used- Returns:
- this will return this registry instance to use
- Throws:
java.lang.Exception
-
-