Package org.simpleframework.xml.core
Class InstanceFactory
java.lang.Object
org.simpleframework.xml.core.InstanceFactory
The
Instantiator
is used to instantiate types that
will leverage a constructor cache to quickly create the objects.
This is used by the various object factories to return type
instances that can be used by converters to create the objects
that will later be deserialized.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
TheClassInstance
object is used to create an object by using aClass
to determine the type.private class
TheValueInstance
object is used to create an object by using aValue
instance to determine the type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Cache
<Constructor> This is used to cache the constructors for the given types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInstance
(Class type) This will create anInstance
that can be used to instantiate objects of the specified class.getInstance
(Value value) This will create anInstance
that can be used to instantiate objects of the specified class.protected Object
This method will instantiate an object of the provided type.
-
Field Details
-
cache
This is used to cache the constructors for the given types.
-
-
Constructor Details
-
InstanceFactory
public InstanceFactory()Constructor for theInstantiator
object. This will create a constructor cache that can be used to cache all of the constructors instantiated for the required types.
-
-
Method Details
-
getInstance
This will create anInstance
that can be used to instantiate objects of the specified class. This leverages an internal constructor cache to ensure creation is quicker.- Parameters:
value
- this contains information on the object instance- Returns:
- this will return an object for instantiating objects
-
getInstance
This will create anInstance
that can be used to instantiate objects of the specified class. This leverages an internal constructor cache to ensure creation is quicker.- Parameters:
type
- this is the type that is to be instantiated- Returns:
- this will return an object for instantiating objects
-
getObject
This method will instantiate an object of the provided type. If the object or constructor does not have public access then this will ensure the constructor is accessible and can be used.- Parameters:
type
- this is used to ensure the object is accessible- Returns:
- this returns an instance of the specific class type
- Throws:
Exception
-