Package org.simpleframework.xml.convert
Class ConverterFactory
- java.lang.Object
-
- org.simpleframework.xml.convert.ConverterFactory
-
class ConverterFactory extends java.lang.ObjectTheConverterFactoryis used to instantiate objects based on a provided type or annotation. This provides a single point of creation for all converters within the framework. For performance all the instantiated converters are cached against the class for that converter. This ensures the converters can be acquired without the overhead of instantiation.- See Also:
org.simpleframework.xml.convert.ConverterCache
-
-
Constructor Summary
Constructors Constructor Description ConverterFactory()Constructor for theConverterFactoryobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.reflect.ConstructorgetConstructor(java.lang.Class type)This is used to acquire the default no argument constructor for the the provided type.private ConvertergetConverter(java.lang.Class type)This is used to instantiate the converter based on the type provided.private ConvertergetConverter(java.lang.Class type, java.lang.reflect.Constructor factory)This is used to instantiate the converter based on the type provided.ConvertergetInstance(java.lang.Class type)This is used to instantiate the converter based on the type provided.ConvertergetInstance(Convert convert)This is used to instantiate the converter based on the type of theConvertannotation provided.
-
-
-
Method Detail
-
getInstance
public Converter getInstance(java.lang.Class type) throws java.lang.Exception
This is used to instantiate the converter based on the type provided. If the type provided can not be instantiated for some reason then an exception is thrown from this method.- Parameters:
type- this is the converter type to be instantiated- Returns:
- this returns an instance of the provided type
- Throws:
java.lang.Exception
-
getInstance
public Converter getInstance(Convert convert) throws java.lang.Exception
This is used to instantiate the converter based on the type of theConvertannotation provided. If the type can not be instantiated for some reason then an exception is thrown from this method.- Parameters:
convert- this is the annotation containing the type- Returns:
- this returns an instance of the provided type
- Throws:
java.lang.Exception
-
getConverter
private Converter getConverter(java.lang.Class type) throws java.lang.Exception
This is used to instantiate the converter based on the type provided. If the type provided can not be instantiated for some reason then an exception is thrown from this method.- Parameters:
type- this is the converter type to be instantiated- Returns:
- this returns an instance of the provided type
- Throws:
java.lang.Exception
-
getConverter
private Converter getConverter(java.lang.Class type, java.lang.reflect.Constructor factory) throws java.lang.Exception
This is used to instantiate the converter based on the type provided. If the type provided can not be instantiated for some reason then an exception is thrown from this method.- Parameters:
type- this is the converter type to be instantiatedfactory- this is the constructor used to instantiate- Returns:
- this returns an instance of the provided type
- Throws:
java.lang.Exception
-
getConstructor
private java.lang.reflect.Constructor getConstructor(java.lang.Class type) throws java.lang.ExceptionThis is used to acquire the default no argument constructor for the the provided type. If the constructor is not accessible then it will be made accessible so that it can be instantiated.- Parameters:
type- this is the type to acquire the constructor for- Returns:
- this returns the constructor for the type provided
- Throws:
java.lang.Exception
-
-