|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormattableObject
AbstractParameter
Parameter<T>
T - The value type.public class Parameter<T>
A parameter value used by an operation method. Most CRS parameter values are numeric and can
be obtained by the intValue() or doubleValue() methods. But other types of
parameter values are possible and can be handled by the more generic getValue() and
setValue(Object) methods. The type and constraints on parameter values are given
by the descriptor.
Instances of ParameterValue are created by the ParameterDescriptor.createValue()
method. The parameter type can be fetch with the following idiom:
Class<? extends T> valueClass = parameter.getDescriptor().getValueClass();
DefaultParameterDescriptor,
ParameterGroup,
Serialized Form
| referencing/geotk-referencing (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class FormattableObject |
|---|
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE |
| Constructor Summary | |
|---|---|
Parameter(ParameterDescriptor<T> descriptor)
Constructs a parameter value from the specified descriptor. |
|
Parameter(ParameterDescriptor<T> descriptor,
T value)
Constructs a parameter value from the specified descriptor and value. |
|
| Method Summary | ||
|---|---|---|
boolean |
booleanValue()
Returns the boolean value of an operation parameter. |
|
Parameter<T> |
clone()
Returns a clone of this parameter. |
|
static
|
create(String name,
Class<T> type,
T value)
Constructs a parameter from the specified code list. |
|
static Parameter<Double> |
create(String name,
double value,
Unit<?> unit)
Constructs a parameter from the specified name and value. |
|
static Parameter<Integer> |
create(String name,
int value)
Constructs a parameter from the specified name and value. |
|
double |
doubleValue()
Returns the numeric value of the coordinate operation parameter with its associated unit of measure. |
|
double |
doubleValue(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(Unit<?> unit)
Returns an ordered sequence of numeric values in the specified unit of measure. |
|
boolean |
equals(Object object)
Compares the specified object with this parameter for equality. |
|
ParameterDescriptor<T> |
getDescriptor()
Returns the abstract definition of this parameter. |
|
Unit<?> |
getUnit()
Returns the unit of measure of the parameter value. |
|
T |
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)
Sets the parameter value as a boolean. |
|
void |
setValue(double value)
Sets the parameter value as a floating point. |
|
void |
setValue(double[] values,
Unit<?> unit)
Sets the parameter value as an array of floating point and their associated unit. |
|
void |
setValue(double value,
Unit<?> unit)
Sets the parameter value as a floating point and its associated unit. |
|
void |
setValue(int value)
Sets the parameter value as an integer. |
|
void |
setValue(Object value)
Sets the parameter value as an object. |
|
String |
stringValue()
Returns the string value of an operation parameter. |
|
URI |
valueFile()
Returns a reference to a file or a part of a file containing one or more parameter values. |
|
| Methods inherited from class AbstractParameter |
|---|
formatWKT, toString, write |
| Methods inherited from class FormattableObject |
|---|
getDefaultIndentation, print, setDefaultIndentation, toWKT, toWKT, toWKT |
| Methods inherited from class Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Parameter(ParameterDescriptor<T> descriptor)
descriptor - The abstract definition of this parameter.
public Parameter(ParameterDescriptor<T> descriptor,
T value)
throws InvalidParameterValueException
descriptor - The abstract definition of this parameter.value - The parameter value.
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 Parameter<Integer> create(String name,
int value)
DefaultParameterDescriptor object. But if such
an object is available, then the preferred way to get a ParameterValue
is to invoke ParameterDescriptor.createValue().
name - The parameter name.value - The parameter value.
public static Parameter<Double> create(String name,
double value,
Unit<?> unit)
DefaultParameterDescriptor object. But if such
an object is available, then the preferred way to get a ParameterValue
is to invoke ParameterDescriptor.createValue().
name - The parameter name.value - The parameter value.unit - The unit for the parameter value.
public static <T extends CodeList<T>> Parameter<T> create(String name,
Class<T> type,
T value)
DefaultParameterDescriptor object. But if
such an object is available, then the preferred way to get a ParameterValue
is to invoke ParameterDescriptor.createValue().
T - The parameter type.name - The parameter name.type - The parameter type.value - The parameter value.
public ParameterDescriptor<T> getDescriptor()
getDescriptor in interface GeneralParameterValuegetDescriptor in interface ParameterValue<T>getDescriptor in class AbstractParameterpublic Unit<?> getUnit()
String type),
then this method returns null. Note that "no unit" doesn't means
"dimensionless".
getUnit in interface ParameterValue<T>null if none.doubleValue(),
doubleValueList(),
getValue()
public double doubleValue(Unit<?> unit)
throws IllegalArgumentException,
IllegalStateException
doubleValue in interface ParameterValue<T>unit - The unit of measure for the value to be returned.
double and conversion to unit.
IllegalArgumentException - if the specified unit is invalid for this parameter.
InvalidParameterTypeException - if the value is not a numeric type.
IllegalStateException - if the value is not defined and there is no default value.getUnit(),
setValue(double,Unit),
doubleValueList(Unit)
public double doubleValue()
throws IllegalStateException
doubleValue in interface ParameterValue<T>double.
InvalidParameterTypeException - if the value is not a numeric type.
IllegalStateException - if the value is not defined and there is no default value.getUnit(),
setValue(double),
doubleValueList()
public int intValue()
throws IllegalStateException
intValue in interface ParameterValue<T>int.
InvalidParameterTypeException - if the value is not an integer type.
IllegalStateException - if the value is not defined and there is no default value.setValue(int),
intValueList()
public boolean booleanValue()
throws IllegalStateException
booleanValue in interface ParameterValue<T>InvalidParameterTypeException - if the value is not a boolean type.
IllegalStateException - if the value is not defined and there is no default value.setValue(boolean)
public String stringValue()
throws IllegalStateException
stringValue in interface ParameterValue<T>InvalidParameterTypeException - if the value is not a string.
IllegalStateException - if the value is not defined and there is no default value.getValue(),
setValue(Object)
public double[] doubleValueList(Unit<?> unit)
throws IllegalArgumentException,
IllegalStateException
doubleValueList in interface ParameterValue<T>unit - The unit of measure for the value to be returned.
double and conversion to unit.
IllegalArgumentException - if the specified unit is invalid for this parameter.
InvalidParameterTypeException - if the value is not an array of doubles.
IllegalStateException - if the value is not defined and there is no default value.getUnit(),
setValue(double[],Unit),
doubleValue(Unit)
public double[] doubleValueList()
throws IllegalStateException
doubleValueList in interface ParameterValue<T>InvalidParameterTypeException - if the value is not an array of doubles.
IllegalStateException - if the value is not defined and there is no default value.getUnit(),
setValue(Object),
doubleValue()
public int[] intValueList()
throws IllegalStateException
intValueList in interface ParameterValue<T>InvalidParameterTypeException - if the value is not an array of ints.
IllegalStateException - if the value is not defined and there is no default value.setValue(Object),
intValue()
public URI valueFile()
throws IllegalStateException
valueFile in interface ParameterValue<T>InvalidParameterTypeException - if the value is not a reference to a file or an URI.
IllegalStateException - if the value is not defined and there is no default value.getValue(),
setValue(Object)public T getValue()
Double,
Integer, Boolean, String, URI, double[] or
int[]. If no value has been set, then this method returns the
default value (which may be null).
getValue in interface ParameterValue<T>null if no value has been set and
there is no default value.setValue(Object)
public void setValue(double value,
Unit<?> unit)
throws InvalidParameterValueException
setValue in interface ParameterValue<T>value - The parameter value.unit - The unit for the specified value.
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 InvalidParameterValueException
setValue in interface ParameterValue<T>value - The parameter value.
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 InvalidParameterValueException
setValue in interface ParameterValue<T>value - The parameter value.
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 InvalidParameterValueException
setValue in interface ParameterValue<T>value - The parameter value.
InvalidParameterValueException - if the boolean type is inappropriate for this parameter.booleanValue()
public void setValue(Object value)
throws InvalidParameterValueException
Double,
Integer, Boolean, String, URI, double[]
or int[].
setValue in interface ParameterValue<T>value - The parameter value.
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,
Unit<?> unit)
throws InvalidParameterValueException
setValue in interface ParameterValue<T>values - The parameter values.unit - The unit for the specified value.
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(Object object)
equals in class AbstractParameterobject - The object to compare to this.
true if both objects are equal.public int hashCode()
hashCode in class AbstractParameterpublic Parameter<T> clone()
clone in interface GeneralParameterValueclone in interface ParameterValue<T>clone in class AbstractParameter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||