T
- The type of elements to be returned by DefaultParameterValue.getValue()
.public class DefaultParameterDescriptor<T> extends AbstractParameterDescriptor implements ParameterDescriptor<T>
A parameter descriptor contains the following properties:
Double
, double[]
,
Integer
, int[]
, Boolean
, String
or URI
,
but other types are allowed as well.DefaultParameterValue
,
DefaultParameterDescriptorGroup
,
Serialized FormDefined in the sis-referencing
module
LOCALE_KEY
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Modifier | Constructor and Description |
---|---|
|
DefaultParameterDescriptor(Map<String,?> properties,
Class<T> valueClass,
Range<?> valueDomain,
T[] validValues,
T defaultValue,
boolean required)
Deprecated.
Replaced by the constructor with explicit minimum and maximum number of occurrences.
|
|
DefaultParameterDescriptor(Map<String,?> properties,
int minimumOccurs,
int maximumOccurs,
Class<T> valueClass,
Range<?> valueDomain,
T[] validValues,
T defaultValue)
Constructs a descriptor from the given properties.
|
protected |
DefaultParameterDescriptor(ParameterDescriptor<T> descriptor)
Creates a new descriptor with the same values than the specified one.
|
Modifier and Type | Method and Description |
---|---|
static <T> DefaultParameterDescriptor<T> |
castOrCopy(ParameterDescriptor<T> object)
Returns a SIS parameter implementation with the same values than the given arbitrary implementation.
|
protected long |
computeHashCode()
Invoked by
AbstractIdentifiedObject.hashCode() for computing the hash code when first needed. |
ParameterValue<T> |
createValue()
Creates a new parameter value instance initialized with the default value.
|
boolean |
equals(Object object,
ComparisonMode mode)
Compares the specified object with this parameter for equality.
|
T |
getDefaultValue()
Returns the default value for the parameter.
|
Class<? extends ParameterDescriptor<T>> |
getInterface()
Returns the GeoAPI interface implemented by this class.
|
Comparable<T> |
getMaximumValue()
Returns the maximum parameter value.
|
Comparable<T> |
getMinimumValue()
Returns the minimum parameter value.
|
Unit<?> |
getUnit()
|
Set<T> |
getValidValues()
If this parameter allows only a finite set of values, returns that set.
|
Class<T> |
getValueClass()
Returns the class that describe the type of the parameter.
|
Range<?> |
getValueDomain()
Returns the domain of values with their unit of measurement (if any), or
null if none. |
formatTo, getDescription, getMaximumOccurs, getMinimumOccurs, print, toString
castOrCopy, equals, getAlias, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
toString, toWKT
getMaximumOccurs, getMinimumOccurs
getAlias, getIdentifiers, getName, getRemarks, toWKT
public DefaultParameterDescriptor(Map<String,?> properties, int minimumOccurs, int maximumOccurs, Class<T> valueClass, Range<?> valueDomain, T[] validValues, T defaultValue)
Property name | Value type | Returned by |
---|---|---|
"name" | ReferenceIdentifier or String |
AbstractIdentifiedObject.getName() |
"alias" | GenericName or CharSequence (optionally as array) |
AbstractIdentifiedObject.getAlias() |
"identifiers" | ReferenceIdentifier (optionally as array) |
AbstractIdentifiedObject.getIdentifiers() |
InternationalString or String |
AbstractParameterDescriptor.getDescription() |
|
"remarks" | InternationalString or String |
AbstractIdentifiedObject.getRemarks() |
valueDomain
argument combines the minimum value,
maximum value, unit of measurement
(if any) and information about whether the bounds are inclusive or exclusive.
If this argument is non-null, then it shall comply to the following conditions:
valueDomain.getElementType()
shall be equals
to one of the following:
valueClass
if the later is not an array,primitiveToWrapper(valueClass.getComponentType())
if valueClass
is an array.valueDomain
and validValues
are non-null, then all valid values shall be contained
in the value domain.properties
- The properties to be given to the identified object.minimumOccurs
- The minimum number of times that values
for this parameter group are required, or 0 if no restriction.maximumOccurs
- The maximum number of times that values
for this parameter group are required, or Integer.MAX_VALUE
if no restriction.valueClass
- The class that describes the type of the parameter value.valueDomain
- The minimum value, maximum value and unit of measurement, or null
if none.validValues
- The list of valid values, or null
if there is no restriction.
This property is mostly for restricting values to a code list
or enumeration subset. It is not necessary to provide this property when all values
from the code list or enumeration are valid.defaultValue
- The default value for the parameter, or null
if none.@Deprecated public DefaultParameterDescriptor(Map<String,?> properties, Class<T> valueClass, Range<?> valueDomain, T[] validValues, T defaultValue, boolean required)
SV_Parameter
,
DefaultParameterDescriptor
has been generalized to accept an arbitrary amount of occurrences.properties
- The properties to be given to the identified object.valueClass
- The class that describes the type of the parameter value.valueDomain
- The minimum value, maximum value and unit of measurement, or null
if none.validValues
- The list of valid values, or null
if there is no restriction.
This property is mostly for restricting values to a code list
or enumeration subset. It is not necessary to provide this property when all values
from the code list or enumeration are valid.defaultValue
- The default value for the parameter, or null
if none.required
- true
if this parameter is mandatory, or false
if it is optional.protected DefaultParameterDescriptor(ParameterDescriptor<T> descriptor)
This constructor performs a shallow copy, i.e. the properties are not cloned.
descriptor
- The descriptor to shallow copy.castOrCopy(ParameterDescriptor)
public static <T> DefaultParameterDescriptor<T> castOrCopy(ParameterDescriptor<T> object)
null
, then this method returns null
.
Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
Otherwise a new SIS implementation is created and initialized to the values of the given object.T
- The type of values.object
- The object to get as a SIS implementation, or null
if none.null
if the argument was null.public Class<? extends ParameterDescriptor<T>> getInterface()
ParameterDescriptor.class
.
ParameterDescriptor
sub-interface. Overriding possibility is left mostly for implementors who wish to extend GeoAPI with their own
set of interfaces.getInterface
in class AbstractParameterDescriptor
ParameterDescriptor.class
or a user-defined sub-interface.public final Class<T> getValueClass()
getValueClass
in interface ParameterDescriptor<T>
public Set<T> getValidValues()
null
if this parameter does not limit values to a finite set.getValidValues
in interface ParameterDescriptor<T>
null
if it does not apply or if there is no restriction.public final Range<?> getValueDomain()
null
if none.
The Range
object combines the value class,
minimum value, maximum value
and whether these values are inclusive or inclusive. If the range is an instance of
MeasurementRange
, then it contains also the unit of measurement.
Range<T>
, or Range<E>
where <E>
is the component
type of <T>
(using wrapper classes for primitive types).null
.Parameters.getValueDomain(ParameterDescriptor)
public Comparable<T> getMinimumValue()
null
.
This is a convenience method for
getValueDomain().getMinValue()
.
Note that this method said nothing about whether the value is inclusive.
getMinimumValue
in interface ParameterDescriptor<T>
Double
), or null
if unbounded.public Comparable<T> getMaximumValue()
null
.
This is a convenience method for
getValueDomain().getMaxValue()
.
Note that this method said nothing about whether the value is inclusive.
getMaximumValue
in interface ParameterDescriptor<T>
Double
), or null
if unbounded.public T getDefaultValue()
Number
or a String
. If there is no default value,
then this method returns null
.getDefaultValue
in interface ParameterDescriptor<T>
null
in none.public Unit<?> getUnit()
Double
).
This is a convenience method for
getValueDomain().unit()
.
getUnit
in interface ParameterDescriptor<T>
null
if it doesn't apply to the value type.public ParameterValue<T> createValue()
this
object.createValue
in interface GeneralParameterDescriptor
createValue
in interface ParameterDescriptor<T>
public boolean equals(Object object, ComparisonMode mode)
AbstractIdentifiedObject.getName()
, compared heuristically
in IGNORE_METADATA
or less strict mode.getValueClass()
getDefaultValue()
getUnit()
ComparisonMode.IGNORE_METADATA
.equals
in interface LenientComparable
equals
in class AbstractParameterDescriptor
object
- The object to compare to this
.mode
- The strictness level of the comparison.true
if both objects are equal according the given comparison mode.AbstractIdentifiedObject.computeHashCode()
,
Utilities.deepEquals(Object, Object, ComparisonMode)
protected long computeHashCode()
AbstractIdentifiedObject.hashCode()
for computing the hash code when first needed.computeHashCode
in class AbstractIdentifiedObject
Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.