|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.referencing.wkt.Formattable
org.geotools.parameter.AbstractParameter
org.geotools.parameter.Parameter
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
getValue().getClass()
idiom.
The getValue()
and setValue(Object)
methods can be invoked at any time.
Others getters and setters are parameter-type dependents.
DefaultParameterDescriptor
,
ParameterGroup
,
Serialized FormConstructor Summary | |
Parameter(org.opengis.parameter.ParameterDescriptor descriptor)
Constructs a parameter value from the specified descriptor. |
|
Parameter(org.opengis.parameter.ParameterDescriptor descriptor,
java.lang.Object value)
Constructs a parameter value from the specified descriptor and value. |
|
Parameter(java.lang.String name,
org.opengis.util.CodeList value)
Constructs a parameter from the specified enumeration. |
|
Parameter(java.lang.String name,
double value,
javax.units.Unit unit)
Constructs a parameter from the specified name and value. |
|
Parameter(java.lang.String name,
int value)
Constructs a parameter from the specified name and value. |
Method Summary | |
boolean |
booleanValue()
Returns the boolean value of an operation parameter A boolean value does not have an associated unit of measure. |
double |
doubleValue()
Returns the numeric value of the coordinate operation parameter with its associated unit of measure. |
double |
doubleValue(javax.units.Unit unit)
Returns the numeric value of the coordinate operation parameter in the specified unit of measure. |
double[] |
doubleValueList()
Returns an ordered sequence of two or more numeric values of an operation parameter list, where each value has the same associated unit of measure. |
double[] |
doubleValueList(javax.units.Unit unit)
Returns an ordered sequence of numeric values in the specified unit of measure. |
static void |
ensureValidValue(org.opengis.parameter.ParameterDescriptor descriptor,
java.lang.Object value)
Ensures that the given value is valid according the specified parameter descriptor. |
boolean |
equals(java.lang.Object object)
Compares the specified object with this parameter for equality. |
javax.units.Unit |
getUnit()
Returns the unit of measure of the parameter value. |
java.lang.Object |
getValue()
Returns the parameter value as an object. |
int |
hashCode()
Returns a hash value for this parameter. |
int |
intValue()
Returns the positive integer value of an operation parameter, usually used for a count. |
int[] |
intValueList()
Returns an ordered sequence of two or more integer values of an operation parameter list, usually used for counts. |
void |
setValue(boolean value)
Set the parameter value as a boolean. |
void |
setValue(double value)
Set the parameter value as a floating point. |
void |
setValue(double[] values,
javax.units.Unit unit)
Set the parameter value as an array of floating point and their associated unit. |
void |
setValue(double value,
javax.units.Unit unit)
Set the parameter value as a floating point and its associated unit. |
void |
setValue(int value)
Set the parameter value as an integer. |
void |
setValue(java.lang.Object value)
Set the parameter value as an object. |
java.lang.String |
stringValue()
Returns the string value of an operation parameter. |
java.net.URI |
valueFile()
Returns a reference to a file or a part of a file containing one or more parameter values. |
protected void |
write(TableWriter table)
Write the content of this parameter to the specified table. |
Methods inherited from class org.geotools.parameter.AbstractParameter |
clone, formatWKT, getDescriptor, toString |
Methods inherited from class org.geotools.referencing.wkt.Formattable |
toWKT, toWKT, toWKT |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opengis.parameter.ParameterValue |
clone |
Methods inherited from interface org.opengis.parameter.GeneralParameterValue |
getDescriptor |
Constructor Detail |
public Parameter(java.lang.String name, int value)
DefaultParameterDescriptor
object. But if such
an object was available, then the preferred way to get a ParameterValue
is to invokes DefaultParameterDescriptor.createValue()
.
name
- The parameter name.value
- The parameter value.public Parameter(java.lang.String name, double value, javax.units.Unit unit)
DefaultParameterDescriptor
object. But if such
an object was available, then the preferred way to get a ParameterValue
is
to invokes DefaultParameterDescriptor.createValue()
.
name
- The parameter name.value
- The parameter value.unit
- The unit for the parameter value.public Parameter(java.lang.String name, org.opengis.util.CodeList value)
DefaultParameterDescriptor
object. But if
such an object was available, then the preferred way to get a ParameterValue
is to invokes DefaultParameterDescriptor.createValue()
.
name
- The parameter name.value
- The parameter value.public Parameter(org.opengis.parameter.ParameterDescriptor descriptor)
descriptor
- The abstract definition of this parameter.public Parameter(org.opengis.parameter.ParameterDescriptor descriptor, java.lang.Object value) throws org.opengis.parameter.InvalidParameterValueException
descriptor
- The abstract definition of this parameter.value
- The parameter value.
org.opengis.parameter.InvalidParameterValueException
- if the type of value
is inappropriate
for this parameter, or if the value is illegal for some other reason (for example
the value is numeric and out of range).Method Detail |
public static void ensureValidValue(org.opengis.parameter.ParameterDescriptor descriptor, java.lang.Object value) throws org.opengis.parameter.InvalidParameterValueException
value
is assignable to the
expected class, is between the
minimum and
maximum values and is one of the
set of valid values.
If the value fails any of those tests, then an exception is thrown.
descriptor
- The parameter descriptor to check against.value
- The value to check, or null
.
org.opengis.parameter.InvalidParameterValueException
- if the parameter value is invalid.public javax.units.Unit getUnit()
String
type),
then this method returns null
. Note that "no unit" doesn't means
"dimensionless".
getUnit
in interface org.opengis.parameter.ParameterValue
null
if none.doubleValue()
,
doubleValueList()
,
getValue()
public double doubleValue(javax.units.Unit unit) throws org.opengis.parameter.InvalidParameterTypeException
doubleValue
in interface org.opengis.parameter.ParameterValue
unit
- The unit of measure for the value to be returned.
double
and conversion to unit
.
org.opengis.parameter.InvalidParameterTypeException
- if the value is not a numeric type.
java.lang.IllegalArgumentException
- if the specified unit is invalid for this parameter.getUnit()
,
setValue(double,Unit)
,
doubleValueList(Unit)
public double doubleValue() throws org.opengis.parameter.InvalidParameterTypeException
doubleValue
in interface org.opengis.parameter.ParameterValue
double
.
org.opengis.parameter.InvalidParameterTypeException
- if the value is not a numeric type.getUnit()
,
setValue(double)
,
doubleValueList()
public int intValue() throws org.opengis.parameter.InvalidParameterTypeException
intValue
in interface org.opengis.parameter.ParameterValue
int
.
org.opengis.parameter.InvalidParameterTypeException
- if the value is not an integer type.setValue(int)
,
intValueList()
public boolean booleanValue() throws org.opengis.parameter.InvalidParameterTypeException
booleanValue
in interface org.opengis.parameter.ParameterValue
org.opengis.parameter.InvalidParameterTypeException
- if the value is not a boolean type.setValue(boolean)
public java.lang.String stringValue() throws org.opengis.parameter.InvalidParameterTypeException
stringValue
in interface org.opengis.parameter.ParameterValue
org.opengis.parameter.InvalidParameterTypeException
- if the value is not a string.getValue()
,
setValue(Object)
public double[] doubleValueList(javax.units.Unit unit) throws org.opengis.parameter.InvalidParameterTypeException
doubleValueList
in interface org.opengis.parameter.ParameterValue
unit
- The unit of measure for the value to be returned.
double
and conversion to unit
.
org.opengis.parameter.InvalidParameterTypeException
- if the value is not an array of double
s.
java.lang.IllegalArgumentException
- if the specified unit is invalid for this parameter.getUnit()
,
setValue(double[],Unit)
,
doubleValue(Unit)
public double[] doubleValueList() throws org.opengis.parameter.InvalidParameterTypeException
doubleValueList
in interface org.opengis.parameter.ParameterValue
org.opengis.parameter.InvalidParameterTypeException
- if the value is not an array of double
s.getUnit()
,
setValue(Object)
,
doubleValue()
public int[] intValueList() throws org.opengis.parameter.InvalidParameterTypeException
intValueList
in interface org.opengis.parameter.ParameterValue
org.opengis.parameter.InvalidParameterTypeException
- if the value is not an array of int
s.setValue(Object)
,
intValue()
public java.net.URI valueFile() throws org.opengis.parameter.InvalidParameterTypeException
valueFile
in interface org.opengis.parameter.ParameterValue
org.opengis.parameter.InvalidParameterTypeException
- if the value is not a reference to a file or an URI.getValue()
,
setValue(Object)
public java.lang.Object getValue()
Double
,
Integer
, Boolean
, String
, URI
, double[]
or
int[]
.
getValue
in interface org.opengis.parameter.ParameterValue
setValue(Object)
public void setValue(double value, javax.units.Unit unit) throws org.opengis.parameter.InvalidParameterValueException
setValue
in interface org.opengis.parameter.ParameterValue
value
- The parameter value.unit
- The unit for the specified value.
org.opengis.parameter.InvalidParameterValueException
- if the floating point type is inappropriate for this
parameter, or if the value is illegal for some other reason (for example a value out
of range).setValue(double)
,
doubleValue(Unit)
public void setValue(double value) throws org.opengis.parameter.InvalidParameterValueException
setValue
in interface org.opengis.parameter.ParameterValue
value
- The parameter value.
org.opengis.parameter.InvalidParameterValueException
- if the floating point type is inappropriate for this
parameter, or if the value is illegal for some other reason (for example a value out
of range).setValue(double,Unit)
,
doubleValue()
public void setValue(int value) throws org.opengis.parameter.InvalidParameterValueException
setValue
in interface org.opengis.parameter.ParameterValue
value
- The parameter value.
org.opengis.parameter.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).intValue()
public void setValue(boolean value) throws org.opengis.parameter.InvalidParameterValueException
setValue
in interface org.opengis.parameter.ParameterValue
value
- The parameter value.
org.opengis.parameter.InvalidParameterValueException
- if the boolean type is inappropriate for this parameter.booleanValue()
public void setValue(java.lang.Object value) throws org.opengis.parameter.InvalidParameterValueException
Double
,
Integer
, Boolean
, String
, URI
, double[]
or int[]
.
setValue
in interface org.opengis.parameter.ParameterValue
value
- The parameter value.
org.opengis.parameter.InvalidParameterValueException
- if the type of value
is inappropriate
for this parameter, or if the value is illegal for some other reason (for example
the value is numeric and out of range).getValue()
public void setValue(double[] values, javax.units.Unit unit) throws org.opengis.parameter.InvalidParameterValueException
setValue
in interface org.opengis.parameter.ParameterValue
values
- The parameter values.unit
- The unit for the specified value.
org.opengis.parameter.InvalidParameterValueException
- if the floating point type is inappropriate for this
parameter, or if the value is illegal for some other reason (for example a value out
of range).public boolean equals(java.lang.Object object)
equals
in class AbstractParameter
object
- The object to compare to this
.
true
if both objects are equal.public int hashCode()
hashCode
in class AbstractParameter
protected void write(TableWriter table) throws java.io.IOException
write
in class AbstractParameter
table
- The table where to format the parameter value.
java.io.IOException
- if an error occurs during output operation.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |