Package org.simpleframework.xml.core
Class ObjectFactory
- java.lang.Object
-
- org.simpleframework.xml.core.Factory
-
- org.simpleframework.xml.core.PrimitiveFactory
-
- org.simpleframework.xml.core.ObjectFactory
-
class ObjectFactory extends PrimitiveFactory
TheObjectFactory
is the most basic factory. This will basically check to see if there is an override type within the XML node provided, if there is then that is instantiated, otherwise the field type is instantiated. Any type created must have a default no argument constructor. If the override type is an abstract class or an interface then this factory throws an exception.
-
-
Constructor Summary
Constructors Constructor Description ObjectFactory(Context context, Type type, java.lang.Class override)
Constructor for theObjectFactory
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instance
getInstance(InputNode node)
This method will instantiate an object of the field type, or if theStrategy
object can resolve a class from the XML element then this is used instead.-
Methods inherited from class org.simpleframework.xml.core.PrimitiveFactory
getInstance, getText
-
Methods inherited from class org.simpleframework.xml.core.Factory
getConversion, getInstance, getOverride, getType, isCompatible, isInstantiable, setOverride
-
-
-
-
Constructor Detail
-
ObjectFactory
public ObjectFactory(Context context, Type type, java.lang.Class override)
Constructor for theObjectFactory
class. This is given the field class that this should create object instances of. If the field type is abstract then the XML node must have sufficient information for theStrategy
object to resolve the implementation class to be instantiated.- Parameters:
context
- the contextual object used by the persistertype
- this is the object type to use for this factory
-
-
Method Detail
-
getInstance
public Instance getInstance(InputNode node) throws java.lang.Exception
This method will instantiate an object of the field type, or if theStrategy
object can resolve a class from the XML element then this is used instead. If the resulting type is abstract or an interface then this method throws an exception.- Overrides:
getInstance
in classPrimitiveFactory
- Parameters:
node
- this is the node to check for the override- Returns:
- this returns an instance of the resulting type
- Throws:
java.lang.Exception
-
-