Class ParametersCreator


  • public class ParametersCreator
    extends Object
    Creates Parameters objects. Parameters are themselves intended to be immutable w/r to their schema after their creation. This allows for the incremental creation of a parameters object.
    Version:
    $Revision$ $Date$
    Author:
    Nick Collier
    • Constructor Detail

      • ParametersCreator

        public ParametersCreator()
    • Method Detail

      • addParameter

        public void addParameter​(String name,
                                 Class type,
                                 Object value,
                                 boolean isReadOnly)
        Adds a parameter to this creator. The next call to createParameters() will create a Parameters object that includes the specified parameter.
        Parameters:
        name - the name of the parameter
        type - the type of the parameter
        value - the default value of the parameter
        isReadOnly - whether or not the parameter value is read only
      • addParameter

        public void addParameter​(String name,
                                 String displayName,
                                 Class type,
                                 Object value,
                                 boolean isReadOnly)
        Adds a parameter to this creator. The next call to createParameters() will create a Parameters object that includes the specified parameter.
        Parameters:
        name - the name of the parameter
        displayName - the display name of the parameter
        type - the type of the parameter
        value - the default value of the parameter
        isReadOnly - whether or not the parameter value is read only
      • contains

        public boolean contains​(String name)
        Gets whether or not this creator contains the named parameter.
        Parameters:
        name - the name of the parameter
        Returns:
        true if this creator contains the named parameter, otherwise false.
      • addParameters

        public void addParameters​(Parameters params)
        Adds all the parameters in the specified Parameters objects to this creator. The next call to createParameters() will create a Parameters object that includes those parameters.
        Parameters:
        params - the parameters to add to this creator.
      • addConstraint

        public void addConstraint​(String name,
                                  List constrainingList)
        Constrains the value of the named to parameter to those in the list.
        Parameters:
        name - the name of the parameter
        constrainingList - a list containing the possible values for the named parameter
      • addConvertor

        public void addConvertor​(String name,
                                 StringConverter converter)
        Adds a converter to convert the named parameter back and forth to a String.
        Parameters:
        name - the name of the parameter
        converter - the converter
      • addConstraint

        public void addConstraint​(String name,
                                  SteppedRange constrainingRange)
        Constrains the value of the named parameter to those in the specified range.
        Parameters:
        name - the name of the parameter
        constrainingRange - a range of the possible values for the named parameter
      • createBoundParameters

        public BoundParameters createBoundParameters​(Class clazz)
                                              throws IntrospectionException
        Create a BoundParameters object containing the currently added parameters as well any annotatated Parameters in the specified class.
        Parameters:
        clazz - the class
        Returns:
        the created BoundParameters.
        Throws:
        IntrospectionException - if there is an error introspecting the specified class for Parameter annotations.
      • createParameters

        public Parameters createParameters()
        Create a Parameters object contains the added parameters. The list of parameters is cleared.
        Returns:
        the created Parameters.
      • getParameterCount

        public int getParameterCount()
        Gets number of currently added parameters.
        Returns:
        number of currently added parameters.