- Type Parameters:
T
- the type of parameter values.
- All Superinterfaces:
GeneralParameterValue
@Classifier(UNION)
@UML(identifier="OperationParameterValue",
specification=ISO_19111)
public interface ParameterValue<T>
extends GeneralParameterValue
A single parameter value used by an operation method. Most CRS parameter values are numeric and can be obtained
by the
The type and constraints on parameter values are given by the descriptor,
Instances of
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.
All xxxValue()
methods in this interface are convenience methods converting the value from Object
to some commonly used types. Those types are specified in ISO 19111 as a union of attributes, listed below with the
corresponding getter and setter methods:
ISO attribute | Java type | Getter method | Setter method |
---|---|---|---|
Object | getValue() | setValue(Object) | |
stringValue | String | stringValue() | setValue(Object) |
value | double | doubleValue() | setValue(double) |
double | doubleValue(Unit) | setValue(double, Unit) | |
valueList | double[] | doubleValueList() | setValue(Object) |
double[] | doubleValueList(Unit) | setValue(double[], Unit) | |
integerValue | int | intValue() | setValue(int) |
integerValueList | int[] | intValueList() | setValue(Object) |
booleanValue | boolean | booleanValue() | setValue(boolean) |
valueFile | URI | valueFile() | setValue(Object) |
valueFileCitation | Citation | getValue() | setValue(Object) |
geographicObject | Geometry | getValue() | setValue(Object) |
ParameterValue
are created by the ParameterDescriptor.createValue()
method.- Since:
- 1.0
- See Also:
Departure from OGC/ISO standard for closer integration with the Java environment
This interface merges theOperationParameterValue
interface and ParameterValue
union.
The valueFileCitation
and geographicObject
properties were omitted because those more
complex objects can be specified by setting the <T>
parameterized type to
Citation
and Geometry
respectively.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Returns the Boolean value of this parameter.clone()
Returns a copy of this parameter value.default double
Returns the numeric value of this operation parameter.default double
doubleValue
(javax.measure.Unit<?> unit) Returns the numeric value of this parameter in the specified unit of measure.default double[]
Returns an ordered sequence of two or more numeric values of this parameter, where each value has the same associated unit of measure.default double[]
doubleValueList
(javax.measure.Unit<?> unit) Returns an ordered sequence of numeric values in the specified unit of measure.Returns the abstract definition of this parameter value.javax.measure.Unit
<?> getUnit()
Returns the unit of measure of the parameter value.getValue()
Returns the parameter value as an object.default int
intValue()
Returns the integer value of this parameter, usually used for a count.default int[]
Returns an ordered sequence of two or more integer values of this parameter, usually used for counts.default void
setValue
(boolean value) Sets the parameter value as a Boolean.default void
setValue
(double value) Sets the parameter value as a floating point.void
setValue
(double[] values, javax.measure.Unit<?> unit) Sets the parameter value as an array of floating point and their associated unit.void
setValue
(double value, javax.measure.Unit<?> unit) Sets the parameter value as a floating point and its associated unit.default void
setValue
(int value) Sets the parameter value as an integer.void
Sets the parameter value as an object.default String
Returns the string value of this parameter.default URI
Returns a reference to a file or a part of a file containing one or more parameter values.
-
Method Details
-
getDescriptor
@UML(identifier="parameter", obligation=MANDATORY, specification=ISO_19111) ParameterDescriptor<T> getDescriptor()Returns the abstract definition of this parameter value.- Specified by:
getDescriptor
in interfaceGeneralParameterValue
- Returns:
- the abstract definition of this parameter value.
-
getUnit
javax.measure.Unit<?> getUnit()Returns the unit of measure of the parameter value. If the parameter value has no unit (for example because it is aString
type), then this method returnsnull
. Note that "no unit" doesn't means "dimensionless".- Returns:
- the unit of measure of the parameter value.
- See Also:
-
doubleValue
default double doubleValue(javax.measure.Unit<?> unit) throws IllegalArgumentException, IllegalStateException Returns the numeric value of this parameter in the specified unit of measure. This convenience method applies unit conversion on the fly as needed. The default implementation invokesgetValue()
andgetUnit()
, then tries to cast and convert the value.- Parameters:
unit
- the unit of measure for the value to be returned.- Returns:
- the numeric value represented by this parameter after conversion to type
double
and conversion tounit
. - Throws:
IllegalArgumentException
- if the specified unit is invalid for this parameter.InvalidParameterTypeException
- if the value is not a numeric type.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
-
doubleValue
@UML(identifier="ParameterValue.value", obligation=CONDITIONAL, specification=ISO_19111) default double doubleValue() throws IllegalStateExceptionReturns the numeric value of this operation parameter. The unit of measurement is specified bygetUnit()
. The default implementation invokesgetValue()
, then tries to cast the value.- Returns:
- the numeric value represented by this parameter after conversion to type
double
. - Throws:
InvalidParameterTypeException
- if the value is not a numeric type.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
- Unit:
- Measure
Departure from OGC/ISO standard in the name
Renamed the method from "value
" to "doubleValue
" for consistency withNumber.doubleValue()
and the other "*Value
" methods defined in this interface. -
intValue
@UML(identifier="ParameterValue.integerValue", obligation=CONDITIONAL, specification=ISO_19111) default int intValue() throws IllegalStateExceptionReturns the integer value of this parameter, usually used for a count. An integer value does not have an associated unit of measure. The default implementation invokesgetValue()
, then tries to cast the value.- Returns:
- the numeric value represented by this parameter after conversion to type
int
. - Throws:
InvalidParameterTypeException
- if the value is not an integer type.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
Departure from OGC/ISO standard in the name
Renamed the method from "integerValue
" to "intValue
" for consistency withNumber.intValue()
and theint
Java primitive type. -
booleanValue
@UML(identifier="ParameterValue.booleanValue", obligation=CONDITIONAL, specification=ISO_19111) default boolean booleanValue() throws IllegalStateExceptionReturns the Boolean value of this parameter. A Boolean value does not have an associated unit of measure. The default implementation invokesgetValue()
, then tries to cast the value.- Returns:
- the Boolean value represented by this parameter.
- Throws:
InvalidParameterTypeException
- if the value is not a Boolean type.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
-
stringValue
@UML(identifier="ParameterValue.stringValue", obligation=CONDITIONAL, specification=ISO_19111) default String stringValue() throws IllegalStateExceptionReturns the string value of this parameter. A string value does not have an associated unit of measure. The default implementation invokesgetValue()
, then tries to cast the value.- Returns:
- the string value represented by this parameter.
- Throws:
InvalidParameterTypeException
- if the value is not a string.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
-
doubleValueList
default double[] doubleValueList(javax.measure.Unit<?> unit) throws IllegalArgumentException, IllegalStateException Returns an ordered sequence of numeric values in the specified unit of measure. This convenience method applies unit conversions on the fly as needed. The default implementation invokesdoubleValueList()
, then tries to convert the values.- Parameters:
unit
- the unit of measure for the value to be returned.- Returns:
- the sequence of values represented by this parameter after conversion to type
double
and conversion tounit
. - Throws:
IllegalArgumentException
- if the specified unit is invalid for this parameter.InvalidParameterTypeException
- if the value is not an array ofdouble
s.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
-
doubleValueList
@UML(identifier="ParameterValue.valueList", obligation=CONDITIONAL, specification=ISO_19111) default double[] doubleValueList() throws IllegalStateExceptionReturns an ordered sequence of two or more numeric values of this parameter, where each value has the same associated unit of measure. The default implementation invokesgetValue()
, then tries to cast the value.- Returns:
- the sequence of values represented by this parameter.
- Throws:
InvalidParameterTypeException
- if the value is not an array ofdouble
s.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
- Unit:
- Measure
Departure from OGC/ISO standard in the name
Renamed the method from "valueList
" to "doubleValueList
" both for consistency withdoubleValue()
and also because, likedoubleValue()
, this method returns an array ofdouble
values rather than aMeasure
object. -
intValueList
@UML(identifier="ParameterValue.integerValueList", obligation=CONDITIONAL, specification=ISO_19111) default int[] intValueList() throws IllegalStateExceptionReturns an ordered sequence of two or more integer values of this parameter, usually used for counts. These integer values do not have an associated unit of measure. The default implementation invokesgetValue()
, then tries to cast the value.- Returns:
- the sequence of values represented by this parameter.
- Throws:
InvalidParameterTypeException
- if the value is not an array ofint
s.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
Departure from OGC/ISO standard in the name
Renamed the attribute from "integerValueList
" to "intValueList
" for consistency withintValue()
. -
valueFile
@UML(identifier="ParameterValue.valueFile", obligation=CONDITIONAL, specification=ISO_19111) default URI valueFile() throws IllegalStateExceptionReturns 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 default implementation invokes
getValue()
, then tries to cast the value.- Returns:
- the reference to a file containing parameter values.
- Throws:
InvalidParameterTypeException
- if the value is not a reference to a file or a URI.IllegalStateException
- if the value cannot be returned for another reason.- See Also:
-
getValue
Returns the parameter value as an object. The object type is typically (but not restricted to)Double
,Integer
,Boolean
,String
,URI
,double[]
orint[]
. If no value has been set, then this method returns the default value (which may be null).- Returns:
- the parameter value as an object, or
null
if no value has been set and there is no default value. - See Also:
-
setValue
Sets the parameter value as an array of floating point and their associated unit.- Parameters:
values
- the parameter values.unit
- the unit for the specified value.- Throws:
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
Sets the parameter value as a floating point and its associated unit.- Parameters:
value
- the parameter value.unit
- the unit for the specified values.- Throws:
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).- See Also:
-
setValue
Sets the parameter value as a floating point. The default implementation delegates tosetValue(Object)
.- Parameters:
value
- the parameter value.- Throws:
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).- See Also:
-
setValue
Sets the parameter value as an integer. The default implementation delegates tosetValue(Object)
.- 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:
-
setValue
Sets the parameter value as a Boolean. The default implementation delegates tosetValue(Object)
.- Parameters:
value
- the parameter value.- Throws:
InvalidParameterValueException
- if the Boolean type is inappropriate for this parameter.- See Also:
-
setValue
Sets the parameter value as an object. The object type is typically (but not restricted to)Double
,Integer
,Boolean
,String
,URI
,double[]
orint[]
.The argument is not restricted to the parameterized type
T
because the type is typically unknown (as ingroup.parameter("name").setValue(value)
) and because some implementations may choose to convert a wider range of types.- Parameters:
value
- the parameter value.- Throws:
InvalidParameterValueException
- if the type ofvalue
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).- See Also:
-
clone
ParameterValue<T> clone()Returns a copy of this parameter value.- Specified by:
clone
in interfaceGeneralParameterValue
- Returns:
- a copy of this parameter value.
-