Class ParameterFactory


  • class ParameterFactory
    extends java.lang.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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  ParameterFactory.ParameterBuilder
      The ParameterBuilder is used to create a constructor that can be used to instantiate the correct parameter for the XML annotation specified.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Format format
      This format contains the style which is used to create names.
    • Constructor Summary

      Constructors 
      Constructor Description
      ParameterFactory​(Support support)
      Constructor for the ParameterFactory object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private ParameterFactory.ParameterBuilder getBuilder​(java.lang.annotation.Annotation label)
      Creates an entry that is used to select the constructor for the parameter.
      private java.lang.reflect.Constructor getConstructor​(java.lang.annotation.Annotation label)
      Creates a constructor that is used to instantiate the parameter used to represent the specified annotation.
      Parameter getInstance​(java.lang.reflect.Constructor factory, java.lang.annotation.Annotation label, int index)
      Creates a Parameter using the provided constructor and the XML annotation.
      Parameter getInstance​(java.lang.reflect.Constructor factory, java.lang.annotation.Annotation label, java.lang.annotation.Annotation entry, int index)
      Creates a Parameter using the provided constructor and the XML annotation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • format

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

      • 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 Detail

      • getInstance

        public Parameter getInstance​(java.lang.reflect.Constructor factory,
                                     java.lang.annotation.Annotation label,
                                     int index)
                              throws java.lang.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:
        java.lang.Exception
      • getInstance

        public Parameter getInstance​(java.lang.reflect.Constructor factory,
                                     java.lang.annotation.Annotation label,
                                     java.lang.annotation.Annotation entry,
                                     int index)
                              throws java.lang.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:
        java.lang.Exception
      • getConstructor

        private java.lang.reflect.Constructor getConstructor​(java.lang.annotation.Annotation label)
                                                      throws java.lang.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:
        java.lang.Exception - thrown if the annotation is not supported
      • getBuilder

        private ParameterFactory.ParameterBuilder getBuilder​(java.lang.annotation.Annotation label)
                                                      throws java.lang.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:
        java.lang.Exception