Package org.geotools.parameter
Class ParameterGroup
Object
Formattable
AbstractParameter
ParameterGroup
- All Implemented Interfaces:
Serializable
,Cloneable
,GeneralParameterValue
,ParameterValueGroup
,Cloneable
- Direct Known Subclasses:
MatrixParameters
A group of related parameter values. The same group can be repeated more than once in an
operation or higher level
ParameterValueGroup
,
if those instances contain different values of one or more ParameterValue
s which suitably distinquish among
those groups.- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD), Jody Garnett (Refractions Research)
- See Also:
-
Field Summary
FieldsFields inherited from class Formattable
SINGLE_LINE
-
Constructor Summary
ConstructorsConstructorDescriptionParameterGroup
(Map<String, ?> properties, GeneralParameterValue... values) Constructs a parameter group from the specified list of parameters.ParameterGroup
(ParameterDescriptorGroup descriptor) Constructs a parameter group from the specified descriptor.ParameterGroup
(ParameterDescriptorGroup descriptor, GeneralParameterValue... values) Constructs a parameter group from the specified descriptor and list of parameters. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new group of the specified name.clone()
Returns a deep copy of this group of parameter values.boolean
Compares the specified object with this parameter for equality.Returns the abstract definition of this group of parameters.Returns all subgroups with the specified name.int
hashCode()
Returns a hash value for this parameter.Returns the value in this group for the specified identifier code.values()
Returns the values in this group.Methods inherited from class AbstractParameter
formatWKT, toString, write
Methods inherited from class Formattable
cleanupThreadLocals, toWKT, toWKT, toWKT, toWKT
-
Field Details
-
EMPTY
An empty parameter value group. This group contains no parameter value.
-
-
Constructor Details
-
ParameterGroup
Constructs a parameter group from the specified descriptor. All parameter values will be initialized to their default value.- Parameters:
descriptor
- The descriptor for this group.
-
ParameterGroup
Constructs a parameter group from the specified descriptor and list of parameters.- Parameters:
descriptor
- The descriptor for this group.values
- The list of parameter values.- Throws:
IllegalStateException
- if the number of parameter occurences doesn't matches the number declared in the descriptor.
-
ParameterGroup
Constructs a parameter group from the specified list of parameters.- Parameters:
properties
- The properties for the operation parameter group to construct from the list of parameters.values
- The list of parameter values.- Throws:
IllegalStateException
- if the number of parameter occurences doesn't matches the number declared in the descriptor.
-
-
Method Details
-
getDescriptor
Returns the abstract definition of this group of parameters.- Specified by:
getDescriptor
in interfaceGeneralParameterValue
- Specified by:
getDescriptor
in interfaceParameterValueGroup
- Overrides:
getDescriptor
in classAbstractParameter
- Returns:
- The abstract definition of this parameter or group of parameters.
-
values
Returns the values in this group. Changes in this list are reflected on thisParameterValueGroup
. The returned list supports theadd
operation.- Specified by:
values
in interfaceParameterValueGroup
- Returns:
- The values in this group.
-
parameter
Returns the value in this group for the specified identifier code. If no parameter value is found but a parameter descriptor is found (which may occurs if the parameter is optional, i.e.minimumOccurs == 0
), then a parameter value is automatically created and initialized to its default value (if any).This convenience method provides a way to get and set parameter values by name. For example the following idiom fetches a floating point value for the
"false_easting"
parameter:double value = parameter("false_easting").doubleValue();
This method do not search recursively in subgroups. This is because more than one subgroup may exist for the same descriptor. The user must query all subgroups and select explicitly the appropriate one to use.
- Specified by:
parameter
in interfaceParameterValueGroup
- Parameters:
name
- The case insensitive identifier code of the parameter to search for.- Returns:
- The parameter value for the given identifier code.
- Throws:
ParameterNotFoundException
- if there is no parameter value for the given identifier code.
-
groups
Returns all subgroups with the specified name. This method do not create new groups. If the requested group is optional (i.e.minimumOccurs == 0
) and no value were set, then this method returns an empty set.- Specified by:
groups
in interfaceParameterValueGroup
- Parameters:
name
- The case insensitive identifier code of the parameter group to search for.- Returns:
- The set of all parameter group for the given identifier code.
- Throws:
ParameterNotFoundException
- if no descriptor was found for the given name.
-
addGroup
public ParameterValueGroup addGroup(String name) throws ParameterNotFoundException, InvalidParameterCardinalityException Creates a new group of the specified name. The specified name must be the identifier code of a descriptor group.- Specified by:
addGroup
in interfaceParameterValueGroup
- Parameters:
name
- The case insensitive identifier code of the parameter group to create.- Returns:
- A newly created parameter group for the given identifier code.
- Throws:
ParameterNotFoundException
- if no descriptor was found for the given name.InvalidParameterCardinalityException
- if this parameter group already contains the maximum number of occurences of subgroups of the given name.
-
equals
Compares the specified object with this parameter for equality.- Overrides:
equals
in classAbstractParameter
- Parameters:
object
- The object to compare tothis
.- Returns:
true
if both objects are equal.
-
hashCode
public int hashCode()Returns a hash value for this parameter.- Overrides:
hashCode
in classAbstractParameter
- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
clone
Returns a deep copy of this group of parameter values. Included parameter values and subgroups are cloned recursively.- Specified by:
clone
in interfaceCloneable
- Specified by:
clone
in interfaceGeneralParameterValue
- Specified by:
clone
in interfaceParameterValueGroup
- Overrides:
clone
in classAbstractParameter
- Returns:
- A copy of this group of parameter values.
- See Also:
-