Package org.simpleframework.xml.core
Class ParameterFactory
java.lang.Object
org.simpleframework.xml.core.ParameterFactory
The
ParameterFactory
object is used to create instances
of the Parameter
object. Each parameter created can be
used to validate against the annotated fields and methods to ensure
that the annotations are compatible.
The Parameter
objects created by this are selected
using the XML annotation type. If the annotation type is not known
the factory will throw an exception, otherwise a parameter instance
is created that will expose the properties of the annotation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
TheParameterBuilder
is used to create a constructor that can be used to instantiate the correct parameter for the XML annotation specified.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParameterFactory
(Support support) Constructor for theParameterFactory
object. -
Method Summary
Modifier and TypeMethodDescriptiongetBuilder
(Annotation label) Creates an entry that is used to select the constructor for the parameter.private Constructor
getConstructor
(Annotation label) Creates a constructor that is used to instantiate the parameter used to represent the specified annotation.getInstance
(Constructor factory, Annotation label, int index) Creates aParameter
using the provided constructor and the XML annotation.getInstance
(Constructor factory, Annotation label, Annotation entry, int index) Creates aParameter
using the provided constructor and the XML annotation.
-
Field Details
-
format
This format contains the style which is used to create names.
-
-
Constructor Details
-
ParameterFactory
Constructor for theParameterFactory
object. This factory is used for creating parameters within a constructor. Parameters can be annotated in the same way as methods or fields, this object is used to create such parameters.- Parameters:
support
- this contains various support functions
-
-
Method Details
-
getInstance
Creates aParameter
using the provided constructor and the XML annotation. The parameter produced contains all information related to the constructor parameter. It knows the name of the XML entity, as well as the type.- Parameters:
factory
- this is the constructor the parameter exists inlabel
- represents the XML annotation for the contactindex
- the index of the parameter in the constructor- Returns:
- returns the parameter instantiated for the field
- Throws:
Exception
-
getInstance
public Parameter getInstance(Constructor factory, Annotation label, Annotation entry, int index) throws Exception Creates aParameter
using the provided constructor and the XML annotation. The parameter produced contains all information related to the constructor parameter. It knows the name of the XML entity, as well as the type.- Parameters:
factory
- this is the constructor the parameter exists inlabel
- represents the XML annotation for the contactentry
- this is the entry annotation for the parameterindex
- the index of the parameter in the constructor- Returns:
- returns the parameter instantiated for the field
- Throws:
Exception
-
getConstructor
Creates a constructor that is used to instantiate the parameter used to represent the specified annotation. The constructor created by this method takes three arguments, a constructor, an annotation, and the parameter index.- Parameters:
label
- the XML annotation representing the label- Returns:
- returns a constructor for instantiating the parameter
- Throws:
Exception
- thrown if the annotation is not supported
-
getBuilder
Creates an entry that is used to select the constructor for the parameter. Each parameter must implement a constructor that takes a constructor, and annotation, and the index of the parameter. If the annotation is not know this method throws an exception.- Parameters:
label
- the XML annotation used to create the parameter- Returns:
- this returns the entry used to create a constructor
- Throws:
Exception
-