Class DefaultParameterValue<T>

Object
FormattableObject
DefaultParameterValue<T>
Type Parameters:
T - the type of the value stored in this parameter.
All Implemented Interfaces:
Serializable, Cloneable, Lenient­Comparable, General­Parameter­Value, Parameter­Value<T>

public class DefaultParameterValue<T> extends FormattableObject implements ParameterValue<T>, LenientComparable, Serializable, Cloneable
A single parameter value used by an operation method. Parameter­Value instances are elements in a parameter value group, in a way similar to Map​.Entry instances in a java​.util​.Map.

In the context of coordinate operations, most parameter values are numeric and can be obtained by the int­Value() or double­Value() methods. But other types of parameter values are possible and can be handled by the more generic get­Value() and set­Value(Object) methods. All xxx­Value() methods in this class are convenience methods converting the value from Object to some commonly used types. Those types are specified in ISO 19111 as an union of attributes, listed below with the corresponding getter and setter methods:

Mapping from ISO attributes to getters and setters
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)
The type and constraints on parameter values are given by the descriptor, which is specified at construction time. The parameter type can be fetch with the following idiom:
Class<T> valueClass = parameter.getDescriptor().getValueClass();

Instantiation

A parameter descriptor must be defined before parameter value can be created. Descriptors are usually predefined by map projection or process providers. Given a descriptor, a parameter value can be created by a call to the Default­Parameter­Value(Parameter­Descriptor) constructor or by a call to the Parameter­Descriptor​.create­Value() method. The latter is recommended since it allows descriptors to return specialized implementations.

Implementation note for subclasses

All read and write operations (except constructors, equals(Object) and hash­Code()) ultimately delegates to the following methods: Consequently, the above-cited methods provide single points that subclasses can override for modifying the behavior of all getter and setter methods.
Since:
0.4
See Also:
  • Field Details

  • Constructor Details

    • DefaultParameterValue

      public DefaultParameterValue(ParameterDescriptor<T> descriptor)
      Creates 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.
    • DefaultParameterValue

      public DefaultParameterValue(ParameterValue<T> parameter)
      Creates a new instance initialized with the values from the specified parameter object. This is a shallow copy constructor, since the value contained in the given object is not cloned.
      Parameters:
      parameter - the parameter to copy values from.
      See Also:
  • Method Details