org.geotools.parameter
Class DefaultParameterDescriptor

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.referencing.AbstractIdentifiedObject
          extended byorg.geotools.parameter.AbstractParameterDescriptor
              extended byorg.geotools.parameter.DefaultParameterDescriptor
All Implemented Interfaces:
org.opengis.parameter.GeneralParameterDescriptor, org.opengis.referencing.IdentifiedObject, org.opengis.parameter.ParameterDescriptor, java.io.Serializable

public class DefaultParameterDescriptor
extends AbstractParameterDescriptor
implements org.opengis.parameter.ParameterDescriptor

The definition of a parameter used by an operation method. For Coordinate Reference Systems most parameter values are numeric, but other types of parameter values are possible.

For numeric values, the value class is usually Double.class, Integer.class or some other Java wrapper class.

This class contains numerous convenience constructors. But all of them ultimately invoke a single, full-featured constructor. All other constructors are just shortcuts.

Since:
2.1
Version:
$Id: DefaultParameterDescriptor.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Parameter, DefaultParameterDescriptorGroup, Serialized Form

Field Summary
 
Fields inherited from class org.geotools.referencing.AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
 
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
 
Constructor Summary
DefaultParameterDescriptor(org.opengis.metadata.citation.Citation authority, java.lang.String name, java.lang.Class valueClass, java.lang.Object[] validValues, java.lang.Object defaultValue, java.lang.Comparable minimum, java.lang.Comparable maximum, javax.units.Unit unit, boolean required)
          Constructs a parameter from an authority and a name.
DefaultParameterDescriptor(java.util.Map properties, java.lang.Class valueClass, java.lang.Object[] validValues, java.lang.Object defaultValue, java.lang.Comparable minimum, java.lang.Comparable maximum, javax.units.Unit unit, boolean required)
          Constructs a parameter from a set of properties.
DefaultParameterDescriptor(java.util.Map properties, double defaultValue, double minimum, double maximum, javax.units.Unit unit, boolean required)
          Constructs a parameter for a range of floating point values.
DefaultParameterDescriptor(java.util.Map properties, int defaultValue, int minimum, int maximum, boolean required)
          Constructs a parameter for a range of integer values.
DefaultParameterDescriptor(org.opengis.parameter.ParameterDescriptor descriptor)
          Constructs a descriptor with the same values than the specified one.
DefaultParameterDescriptor(java.lang.String name, java.lang.CharSequence remarks, java.lang.Object defaultValue, boolean required)
          Constructs a parameter for a name and a default value.
DefaultParameterDescriptor(java.lang.String name, java.lang.Class valueClass, java.lang.Object[] validValues, java.lang.Object defaultValue)
          Constructs a mandatory parameter for a set of predefined values.
DefaultParameterDescriptor(java.lang.String name, org.opengis.util.CodeList defaultValue)
          Constructs a parameter for a code list (or enumeration).
DefaultParameterDescriptor(java.lang.String name, double defaultValue, double minimum, double maximum, javax.units.Unit unit)
          Constructs a mandatory parameter for a range of floating point values.
DefaultParameterDescriptor(java.lang.String name, int defaultValue, int minimum, int maximum)
          Constructs a mandatory parameter for a range of integer values.
 
Method Summary
 org.opengis.parameter.GeneralParameterValue createValue()
          Creates a new instance of parameter value initialized with the default value.
 boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
          Compares the specified object with this parameter for equality.
 java.lang.Object getDefaultValue()
          Returns the default value for the parameter.
 int getMaximumOccurs()
          The maximum number of times that values for this parameter group or parameter can be included.
 java.lang.Comparable getMaximumValue()
          Returns the maximum parameter value.
 java.lang.Comparable getMinimumValue()
          Returns the minimum parameter value.
 javax.units.Unit getUnit()
          Returns the unit for default, minimum and maximum values.
 java.util.Set getValidValues()
          If this parameter allows only a finite set of values, returns this set.
 java.lang.Class getValueClass()
          Returns the class that describe the type of the parameter.
 int hashCode()
          Returns a hash value for this parameter.
 
Methods inherited from class org.geotools.parameter.AbstractParameterDescriptor
formatWKT, getMinimumOccurs
 
Methods inherited from class org.geotools.referencing.AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
toString, toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.parameter.GeneralParameterDescriptor
getMinimumOccurs
 
Methods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
 

Constructor Detail

DefaultParameterDescriptor

public DefaultParameterDescriptor(org.opengis.parameter.ParameterDescriptor descriptor)
Constructs a descriptor with the same values than the specified one. This copy constructor may be used in order to wraps an arbitrary implementation into a Geotools one.

Since:
2.2

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.lang.String name,
                                  int defaultValue,
                                  int minimum,
                                  int maximum)
Constructs a mandatory parameter for a range of integer values.

Parameters:
name - The parameter name.
defaultValue - The default value for the parameter.
minimum - The minimum parameter value, or Integer.MIN_VALUE if none.
maximum - The maximum parameter value, or Integer.MAX_VALUE if none.

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.util.Map properties,
                                  int defaultValue,
                                  int minimum,
                                  int maximum,
                                  boolean required)
Constructs a parameter for a range of integer values.

Parameters:
properties - The parameter properties (name, identifiers, alias...).
defaultValue - The default value for the parameter.
minimum - The minimum parameter value, or Integer.MIN_VALUE if none.
maximum - The maximum parameter value, or Integer.MAX_VALUE if none.
required - if this parameter is required, otherwise.

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.lang.String name,
                                  double defaultValue,
                                  double minimum,
                                  double maximum,
                                  javax.units.Unit unit)
Constructs a mandatory parameter for a range of floating point values.

Parameters:
name - The parameter name.
defaultValue - The default value for the parameter, or Double.NaN if none.
minimum - The minimum parameter value, or Double.NEGATIVE_INFINITY if none.
maximum - The maximum parameter value, or Double.POSITIVE_INFINITY if none.
unit - The unit for default, minimum and maximum values.

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.util.Map properties,
                                  double defaultValue,
                                  double minimum,
                                  double maximum,
                                  javax.units.Unit unit,
                                  boolean required)
Constructs a parameter for a range of floating point values.

Parameters:
properties - The parameter properties (name, identifiers, alias...).
defaultValue - The default value for the parameter, or Double.NaN if none.
minimum - The minimum parameter value, or Double.NEGATIVE_INFINITY if none.
maximum - The maximum parameter value, or Double.POSITIVE_INFINITY if none.
unit - The unit for default, minimum and maximum values.
required - if this parameter is required, otherwise.

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.lang.String name,
                                  java.lang.CharSequence remarks,
                                  java.lang.Object defaultValue,
                                  boolean required)
Constructs a parameter for a name and a default value. The parameter type will be assumed the same than the default value class.

Parameters:
name - The parameter name.
remarks - An optional description as a String or an InternationalString, or if none.
defaultValue - The default value.
required - if this parameter is required, otherwise.

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.lang.String name,
                                  org.opengis.util.CodeList defaultValue)
Constructs a parameter for a code list (or enumeration).

Parameters:
name - The parameter name.
defaultValue - The default value.

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.lang.String name,
                                  java.lang.Class valueClass,
                                  java.lang.Object[] validValues,
                                  java.lang.Object defaultValue)
Constructs a mandatory parameter for a set of predefined values.

Parameters:
name - The parameter name.
valueClass - The class that describe the type of the parameter.
validValues - A finite set of valid values (usually from a {linkplain org.opengis.util.CodeList code list}) or if it doesn't apply.
defaultValue - The default value for the parameter, or .

DefaultParameterDescriptor

public DefaultParameterDescriptor(org.opengis.metadata.citation.Citation authority,
                                  java.lang.String name,
                                  java.lang.Class valueClass,
                                  java.lang.Object[] validValues,
                                  java.lang.Object defaultValue,
                                  java.lang.Comparable minimum,
                                  java.lang.Comparable maximum,
                                  javax.units.Unit unit,
                                  boolean required)
Constructs a parameter from an authority and a name.

Parameters:
authority - The authority (e.g. OGC).
name - The parameter name.
valueClass - The class that describe the type of the parameter.
validValues - A finite set of valid values (usually from a {linkplain org.opengis.util.CodeList code list}) or if it doesn't apply.
defaultValue - The default value for the parameter, or .
minimum - The minimum parameter value, or .
maximum - The maximum parameter value, or .
unit - The unit for default, minimum and maximum values.
required - if this parameter is required, or if it is optional.
Since:
2.2

DefaultParameterDescriptor

public DefaultParameterDescriptor(java.util.Map properties,
                                  java.lang.Class valueClass,
                                  java.lang.Object[] validValues,
                                  java.lang.Object defaultValue,
                                  java.lang.Comparable minimum,
                                  java.lang.Comparable maximum,
                                  javax.units.Unit unit,
                                  boolean required)
Constructs a parameter from a set of properties. The properties map is given unchanged to the super-class constructor.

Parameters:
properties - Set of properties. Should contains at least "name".
valueClass - The class that describe the type of the parameter.
validValues - A finite set of valid values (usually from a {linkplain org.opengis.util.CodeList code list}) or if it doesn't apply.
defaultValue - The default value for the parameter, or .
minimum - The minimum parameter value, or .
maximum - The maximum parameter value, or .
unit - The unit for default, minimum and maximum values.
required - if this parameter is required, or if it is optional.
Method Detail

getMaximumOccurs

public int getMaximumOccurs()
The maximum number of times that values for this parameter group or parameter can be included. For a single parameter, the value is always 1.

Specified by:
getMaximumOccurs in interface org.opengis.parameter.GeneralParameterDescriptor
Specified by:
getMaximumOccurs in class AbstractParameterDescriptor
See Also:
AbstractParameterDescriptor.getMinimumOccurs()

createValue

public org.opengis.parameter.GeneralParameterValue createValue()
Creates a new instance of parameter value initialized with the default value. The parameter value descriptor for the created parameter value will be object.

If the value class specified at construction time was a primitive type (e.g. Double.TYPE instead of Double.class), then this method may returns a specialized parameter value implementation for this primitive type. Specialized implementations may use less storage space and be more flexible during conversions (for example from to String), but this flexibility is not always wanted.

Specified by:
createValue in interface org.opengis.parameter.GeneralParameterDescriptor
Specified by:
createValue in class AbstractParameterDescriptor

getValueClass

public java.lang.Class getValueClass()
Returns the class that describe the type of the parameter. If the value class specified at construction time was a primitive type (e.g. ), it is converted to the corresponding wrapper class (e.g. Double).

Specified by:
getValueClass in interface org.opengis.parameter.ParameterDescriptor
Returns:
The parameter value class (never a primitive type).

getValidValues

public java.util.Set getValidValues()
If this parameter allows only a finite set of values, returns this set. This set is usually a {linkplain org.opengis.util.CodeList code list} or enumerations. This method returns if this parameter doesn't limits values to a finite set.

Specified by:
getValidValues in interface org.opengis.parameter.ParameterDescriptor
Returns:
A finite set of valid values (usually from a {linkplain org.opengis.util.CodeList code list}), or if it doesn't apply.

getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value for the parameter. The return type can be any type including a Number or a String. If there is no default value, then this method returns .

Specified by:
getDefaultValue in interface org.opengis.parameter.ParameterDescriptor
Returns:
The default value, or in none.

getMinimumValue

public java.lang.Comparable getMinimumValue()
Returns the minimum parameter value. If there is no minimum value, or if minimum value is inappropriate for the parameter type, then this method returns .

Specified by:
getMinimumValue in interface org.opengis.parameter.ParameterDescriptor
Returns:
The minimum parameter value (often an instance of Double), or .

getMaximumValue

public java.lang.Comparable getMaximumValue()
Returns the maximum parameter value. If there is no maximum value, or if maximum value is inappropriate for the parameter type, then this method returns .

Specified by:
getMaximumValue in interface org.opengis.parameter.ParameterDescriptor
Returns:
The minimum parameter value (often an instance of Double), or .

getUnit

public javax.units.Unit getUnit()
Returns the unit for default, minimum and maximum values. This attribute apply only if the values is of numeric type (usually an instance of Double).

Specified by:
getUnit in interface org.opengis.parameter.ParameterDescriptor
Returns:
The unit for numeric value, or if it doesn't apply to the value type.

equals

public boolean equals(AbstractIdentifiedObject object,
                      boolean compareMetadata)
Compares the specified object with this parameter for equality.

Overrides:
equals in class AbstractParameterDescriptor
Parameters:
object - The object to compare to .
compareMetadata - for performing a strict comparaison, or for comparing only properties relevant to transformations.
Returns:
if both objects are equal.

hashCode

public int hashCode()
Returns a hash value for this parameter.

Overrides:
hashCode in class AbstractParameterDescriptor
Returns:
The hash code value. This value doesn't need to be the same in past or future versions of this class.


Copyright © GeoTools. All Rights Reserved.