| org.geotools.parameter.AbstractParameter org.geotools.parameter.Parameter
All known Subclasses: org.geotools.data.wms.gce.WMSParameterValue,
Parameter | public class Parameter extends AbstractParameter implements ParameterValue(Code) | | A parameter value used by an operation method.
Most CRS parameter values are numeric, but other types of parameter values are possible.
The parameter type can be fetch with the
.
idiom.
The
Parameter.getValue() and
Parameter.setValue(Object) methods can be invoked at any time.
Others getters and setters are parameter-type dependents.
since: 2.1 version: $Id: Parameter.java 26799 2007-08-31 21:31:21Z desruisseaux $ author: Martin Desruisseaux author: Jody Garnett (Refractions Research) See Also: DefaultParameterDescriptor See Also: ParameterGroup |
Constructor Summary | |
public | Parameter(String name, int value) Constructs a parameter from the specified name and value. | public | Parameter(String name, double value, Unit unit) Constructs a parameter from the specified name and value. | public | Parameter(String name, CodeList value) Constructs a parameter from the specified enumeration. | public | Parameter(ParameterDescriptor descriptor) Constructs a parameter value from the specified descriptor. | public | Parameter(ParameterDescriptor descriptor, Object value) Constructs a parameter value from the specified descriptor and value. |
Method Summary | |
public boolean | booleanValue() Returns the boolean value of an operation parameter. | public double | doubleValue(Unit unit) Returns the numeric value of the coordinate operation parameter in the specified unit
of measure. | public double | doubleValue() Returns the numeric value of the coordinate operation parameter with its
associated
. | public double[] | doubleValueList(Unit unit) Returns an ordered sequence of numeric values in the specified unit of measure.
This convenience method apply unit conversion on the fly as needed.
Parameters: unit - The unit of measure for the value to be returned. | public double[] | doubleValueList() Returns an ordered sequence of two or more numeric values of an operation parameter
list, where each value has the same associated
. | public static void | ensureValidValue(ParameterDescriptor descriptor, Object value) Ensures that the given value is valid according the specified parameter descriptor. | public boolean | equals(Object object) Compares the specified object with this parameter for equality.
Parameters: object - The object to compare to this . | public Unit | getUnit() Returns the unit of measure of the
.
If the parameter value has no unit (for example because it is a
String type),
then this method returns
null . | static int | getUnitMessageID(Unit unit) Returns the unit type as one of error message code. | public Object | getValue() Returns the parameter value as an object. | public int | hashCode() Returns a hash value for this parameter.
The hash code value. | public int | intValue() Returns the positive integer value of an operation parameter, usually used
for a count. | public int[] | intValueList() Returns an ordered sequence of two or more integer values of an operation parameter list,
usually used for counts. | static Comparable | replace(Comparable value) Replace the specified value by the cached value, if it exists. | public void | setValue(double value, Unit unit) Set the parameter value as a floating point and its associated unit. | public void | setValue(double value) Set the parameter value as a floating point. | public void | setValue(int value) Set the parameter value as an integer. | public void | setValue(boolean value) Set the parameter value as a boolean. | public void | setValue(Object value) Set the parameter value as an object. | public void | setValue(double[] values, Unit unit) Set the parameter value as an array of floating point and their associated unit. | public String | stringValue() Returns the string value of an operation parameter. | public URI | valueFile() Returns a reference to a file or a part of a file containing one or more parameter
values. | static Integer | wrap(int value) Wraps the specified value in an
Integer object. | static Double | wrap(double value) Wraps the specified value in an
Double object. |
Parameter | public Parameter(String name, int value)(Code) | | Constructs a parameter from the specified name and value. This convenience
constructor creates a
DefaultParameterDescriptor object. But if such
an object was available, then the preferred way to get a
ParameterValue is to invokes
ParameterDescriptor.createValue .
Parameters: name - The parameter name. Parameters: value - The parameter value. |
Parameter | public Parameter(String name, double value, Unit unit)(Code) | | Constructs a parameter from the specified name and value. This convenience
constructor creates a
DefaultParameterDescriptor object. But if such
an object was available, then the preferred way to get a
ParameterValue is
to invokes
ParameterDescriptor.createValue .
Parameters: name - The parameter name. Parameters: value - The parameter value. Parameters: unit - The unit for the parameter value. |
Parameter | public Parameter(String name, CodeList value)(Code) | | Constructs a parameter from the specified enumeration. This convenience
constructor creates a
DefaultParameterDescriptor object. But if
such an object was available, then the preferred way to get a
ParameterValue is to invokes
ParameterDescriptor.createValue .
Parameters: name - The parameter name. Parameters: value - The parameter value. |
Parameter | public Parameter(ParameterDescriptor descriptor)(Code) | | Constructs a parameter value from the specified descriptor.
The value will be initialized to the default value, if any.
Parameters: descriptor - The abstract definition of this parameter. |
Parameter | public Parameter(ParameterDescriptor descriptor, Object value) throws InvalidParameterValueException(Code) | | Constructs a parameter value from the specified descriptor and value.
Parameters: descriptor - The abstract definition of this parameter. Parameters: value - The parameter value. throws: InvalidParameterValueException - if the type of value is inappropriatefor this parameter, or if the value is illegal for some other reason (for examplethe value is numeric and out of range). |
booleanValue | public boolean booleanValue() throws InvalidParameterTypeException(Code) | | Returns the boolean value of an operation parameter.
A boolean value does not have an associated unit of measure.
The boolean value represented by this parameter. throws: InvalidParameterTypeException - if the value is not a boolean type. See Also: Parameter.setValue(boolean) |
doubleValue | public double doubleValue(Unit unit) throws InvalidParameterTypeException(Code) | | Returns the numeric value of the coordinate operation parameter in the specified unit
of measure. This convenience method apply unit conversion on the fly as needed.
Parameters: unit - The unit of measure for the value to be returned. The numeric value represented by this parameter after conversion to type double and conversion to unit . throws: InvalidParameterTypeException - if the value is not a numeric type. throws: IllegalArgumentException - if the specified unit is invalid for this parameter. See Also: Parameter.getUnit See Also: Parameter.setValue(double,Unit) See Also: Parameter.doubleValueList(Unit) |
doubleValue | public double doubleValue() throws InvalidParameterTypeException(Code) | | Returns the numeric value of the coordinate operation parameter with its
associated
.
The numeric value represented by this parameter after conversion to type double . throws: InvalidParameterTypeException - if the value is not a numeric type. See Also: Parameter.getUnit See Also: Parameter.setValue(double) See Also: Parameter.doubleValueList() |
doubleValueList | public double[] doubleValueList(Unit unit) throws InvalidParameterTypeException(Code) | | Returns an ordered sequence of numeric values in the specified unit of measure.
This convenience method apply unit conversion on the fly as needed.
Parameters: unit - The unit of measure for the value to be returned. The sequence of values represented by this parameter after conversion to type double and conversion to unit . throws: InvalidParameterTypeException - if the value is not an array of double s. throws: IllegalArgumentException - if the specified unit is invalid for this parameter. See Also: Parameter.getUnit See Also: Parameter.setValue(double[],Unit) See Also: Parameter.doubleValue(Unit) |
doubleValueList | public double[] doubleValueList() throws InvalidParameterTypeException(Code) | | Returns an ordered sequence of two or more numeric values of an operation parameter
list, where each value has the same associated
.
The sequence of values represented by this parameter. throws: InvalidParameterTypeException - if the value is not an array of double s. See Also: Parameter.getUnit See Also: Parameter.setValue(Object) See Also: Parameter.doubleValue() |
ensureValidValue | public static void ensureValidValue(ParameterDescriptor descriptor, Object value) throws InvalidParameterValueException(Code) | | Ensures that the given value is valid according the specified parameter descriptor.
This convenience method ensures that
value is assignable to the
, is between the
and
values and is one of the
.
If the value fails any of those tests, then an exception is thrown.
Parameters: descriptor - The parameter descriptor to check against. Parameters: value - The value to check, or null . throws: InvalidParameterValueException - if the parameter value is invalid. |
equals | public boolean equals(Object object)(Code) | | Compares the specified object with this parameter for equality.
Parameters: object - The object to compare to this . true if both objects are equal. |
getUnitMessageID | static int getUnitMessageID(Unit unit)(Code) | | Returns the unit type as one of error message code. Used for checking unit with a better
error message formatting if needed.
Note: It is difficult to differentiate scale and angular units, since both of them are
dimensionless. However, in EPSG database version 6.7, there is only 3 scale units
and all of them maps to
Unit.ONE or
Units.PPM . Consequently, they
are hard-coded and treated especially by this method.
|
hashCode | public int hashCode()(Code) | | Returns a hash value for this parameter.
The hash code value. This value doesn't need to be the samein past or future versions of this class. |
intValue | public int intValue() throws InvalidParameterTypeException(Code) | | Returns the positive integer value of an operation parameter, usually used
for a count. An integer value does not have an associated unit of measure.
The numeric value represented by this parameter after conversion to type int . throws: InvalidParameterTypeException - if the value is not an integer type. See Also: Parameter.setValue(int) See Also: Parameter.intValueList |
intValueList | public int[] intValueList() throws InvalidParameterTypeException(Code) | | Returns an ordered sequence of two or more integer values of an operation parameter list,
usually used for counts. These integer values do not have an associated unit of measure.
The sequence of values represented by this parameter. throws: InvalidParameterTypeException - if the value is not an array of int s. See Also: Parameter.setValue(Object) See Also: Parameter.intValue |
replace | static Comparable replace(Comparable value)(Code) | | Replace the specified value by the cached value, if it exists.
This is used for reducing memory usage for frequently used values.
|
setValue | public void setValue(double value, Unit unit) throws InvalidParameterValueException(Code) | | Set the parameter value as a floating point and its associated unit.
Parameters: value - The parameter value. Parameters: unit - The unit for the specified value. throws: InvalidParameterValueException - if the floating point type is inappropriate for thisparameter, or if the value is illegal for some other reason (for example a value outof range). See Also: Parameter.setValue(double) See Also: Parameter.doubleValue(Unit) |
setValue | public void setValue(double value) throws InvalidParameterValueException(Code) | | Set the parameter value as a floating point.
The unit, if any, stay unchanged.
Parameters: value - The parameter value. throws: InvalidParameterValueException - if the floating point type is inappropriate for thisparameter, or if the value is illegal for some other reason (for example a value outof range). See Also: Parameter.setValue(double,Unit) See Also: Parameter.doubleValue() |
setValue | public void setValue(int value) throws InvalidParameterValueException(Code) | | Set the parameter value as an integer.
Parameters: value - The parameter value. throws: InvalidParameterValueException - if the integer type is inappropriate for this parameter,or if the value is illegal for some other reason (for example a value out of range). See Also: Parameter.intValue |
setValue | public void setValue(boolean value) throws InvalidParameterValueException(Code) | | Set the parameter value as a boolean.
Parameters: value - The parameter value. throws: InvalidParameterValueException - if the boolean type is inappropriate for this parameter. See Also: Parameter.booleanValue |
setValue | public void setValue(Object value) throws InvalidParameterValueException(Code) | | Set the parameter value as an object. The object type is typically a
Double ,
Integer ,
Boolean ,
String ,
URI ,
double[] or
int[] .
Parameters: value - The parameter value. throws: InvalidParameterValueException - if the type of value is inappropriatefor this parameter, or if the value is illegal for some other reason (for examplethe value is numeric and out of range). See Also: Parameter.getValue |
setValue | public void setValue(double[] values, Unit unit) throws InvalidParameterValueException(Code) | | Set the parameter value as an array of floating point and their associated unit.
Parameters: values - The parameter values. Parameters: unit - The unit for the specified value. throws: InvalidParameterValueException - if the floating point type is inappropriate for thisparameter, or if the value is illegal for some other reason (for example a value outof range). |
stringValue | public String stringValue() throws InvalidParameterTypeException(Code) | | Returns the string value of an operation parameter.
A string value does not have an associated unit of measure.
The string value represented by this parameter. throws: InvalidParameterTypeException - if the value is not a string. See Also: Parameter.getValue See Also: Parameter.setValue(Object) |
valueFile | public URI valueFile() throws InvalidParameterTypeException(Code) | | Returns a reference to a file or a part of a file containing one or more parameter
values. When referencing a part of a file, that file must contain multiple identified
parts, such as an XML encoded document. Furthermore, the referenced file or part of a
file can reference another part of the same or different files, as allowed in XML documents.
The reference to a file containing parameter values. throws: InvalidParameterTypeException - if the value is not a reference to a file or an URI. See Also: Parameter.getValue See Also: Parameter.setValue(Object) |
Fields inherited from org.geotools.parameter.AbstractParameter | final GeneralParameterDescriptor descriptor(Code)(Java Doc)
|
|
|