Class ParameterFactory

java.lang.Object
org.simpleframework.xml.core.ParameterFactory

class ParameterFactory extends Object
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.

  • Field Details

    • format

      private final Format format
      This format contains the style which is used to create names.
  • Constructor Details

    • ParameterFactory

      public ParameterFactory(Support support)
      Constructor for the ParameterFactory 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

      public Parameter getInstance(Constructor factory, Annotation label, int index) throws Exception
      Creates a Parameter 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 in
      label - represents the XML annotation for the contact
      index - 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 a Parameter 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 in
      label - represents the XML annotation for the contact
      entry - this is the entry annotation for the parameter
      index - the index of the parameter in the constructor
      Returns:
      returns the parameter instantiated for the field
      Throws:
      Exception
    • getConstructor

      private Constructor getConstructor(Annotation label) throws Exception
      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

      private ParameterFactory.ParameterBuilder getBuilder(Annotation label) throws Exception
      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