Class DefaultParameterDescriptor<T>
Object
FormattableObject
AbstractIdentifiedObject
AbstractParameterDescriptor
DefaultParameterDescriptor<T>
- Type Parameters:
T- the type of elements to be returned byDefaultParameterValue.getValue().
- All Implemented Interfaces:
Serializable, Formattable, Deprecable, LenientComparable, Printable, GeneralParameterDescriptor, ParameterDescriptor<T>, IdentifiedObject
public class DefaultParameterDescriptor<T>
extends AbstractParameterDescriptor
implements ParameterDescriptor<T>
The definition of a single parameter used by an operation method.
For Coordinate Reference Systems
most parameter values are numeric, but other types of parameter values are possible.
A parameter descriptor contains the following properties:
- The parameter name.
- The class of values. This is usually
Double,double[],Integer,int[],Boolean,StringorURI, but other types are allowed as well. - Whether this parameter is optional or mandatory. This is specified by the minimum occurences number, which can be 0 or 1 respectively.
- The domain of values, as a minimum value, maximum value or an enumeration of valid values.
- The default value.
- The unit of measurement.
- Since:
- 0.4
- See Also:
-
Field Summary
Fields inherited from class AbstractIdentifiedObject
DEPRECATED_KEY, DOMAINS_KEY, LOCALE_KEYModifier and TypeFieldDescriptionstatic final StringOptional key which can be given to the constructor for specifying the object is deprecated.static final StringKey for the"domains"property to be given to theObjectFactory.createFoo(Map, ...)methods.static final StringOptional key which can be given to the constructor for specifying the locale to use for producing error messages.Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionDefaultParameterDescriptor(Map<String, ?> properties, int minimumOccurs, int maximumOccurs, Class<T> valueClass, Range<?> valueDomain, T[] validValues, T defaultValue) Constructs a descriptor from the given properties.protectedDefaultParameterDescriptor(ParameterDescriptor<T> descriptor) Creates a new descriptor with the same values as the specified one. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> DefaultParameterDescriptor<T> castOrCopy(ParameterDescriptor<T> object) Returns a SIS parameter implementation with the same values as the given arbitrary implementation.Creates a new parameter value instance initialized with the default value.booleanequals(Object object, ComparisonMode mode) Compares the specified object with this parameter for equality.Returns the default value for the parameter.Returns the maximum parameter value.Returns the minimum parameter value.Returns the GeoAPI interface that defines the contract of this implementation class.Unit<?> getUnit()Returns the unit of measurement for the minimum, maximum and default values.If this parameter allows only a finite set of values, returns that set.Returns the class that describes the type of parameter values.final Range<?> Returns the domain of values with their unit of measurement (if any), ornullif none.Returns the name that describes the type of parameter values.Methods inherited from class AbstractParameterDescriptor
formatTo, getMaximumOccurs, getMinimumOccurs, print, toStringModifier and TypeMethodDescriptionprotected StringFormats this descriptor as a pseudo-Well Known Text element.intThe maximum number of times that values for this parameter group or parameter can be included.intThe minimum number of times that values for this parameter group or parameter are required.voidprint()Prints a string representation of this descriptor to the standard output stream.Returns a string representation of this descriptor.Methods inherited from class AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getDomains, getIdentifiers, getInterface, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForNameModifier and TypeMethodDescriptionstatic AbstractIdentifiedObjectcastOrCopy(IdentifiedObject object) Returns a SIS identified object implementation with the values of the given arbitrary implementation.final booleanCompares the specified object with this object for equality.voidFormats the name or identifier of this object using the provider formatter.Returns alternative names by which this object is identified.Returns a narrative explanation of the role of this object.Returns the usage of this CRS-related object.Returns identifiers which references elsewhere the object's defining information.final Class<? extends IdentifiedObject> Deprecated, for removal: This API element is subject to removal in a future version.getName()Returns the primary name by which this object is identified.Returns comments on or information about this object, including data source information.final intReturns a hash value for this identified object.booleanReturnstrueif this object is deprecated.booleanReturnstrueif either the primary name or at least one alias matches the given string according heuristic rules.Methods inherited from class FormattableObject
toString, toWKTModifier and TypeMethodDescriptiontoString(Convention convention) Returns a Well Known Text (WKT) for this object using the specified convention.toWKT()Returns a strictly compliant Well Known Text (WKT) using the default convention, symbols and indentation.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface IdentifiedObject
toWKT
-
Constructor Details
-
DefaultParameterDescriptor
public DefaultParameterDescriptor(Map<String, ?> properties, int minimumOccurs, int maximumOccurs, Class<T> valueClass, Range<?> valueDomain, T[] validValues, T defaultValue) Constructs a descriptor from the given properties. The properties map is given unchanged to the super-class constructor. The following table is a reminder of main (not all) properties:
TheRecognized properties (non exhaustive list) Property name Value type Returned by "name" ReferenceIdentifierorStringAbstractIdentifiedObject.getName()"alias" GenericNameorCharSequence(optionally as array)AbstractIdentifiedObject.getAlias()"identifiers" ReferenceIdentifier(optionally as array)AbstractIdentifiedObject.getIdentifiers()"description" InternationalStringorStringAbstractIdentifiedObject.getDescription()"remarks" InternationalStringorStringAbstractIdentifiedObject.getRemarks()valueDomainargument 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:- The range shall be non-empty.
valueDomain.getElementType()shall be equal to one of the following:- to
valueClassif the latter is not an array, - or to
if(valueClass.getComponentType())invalid reference
primitiveToWrapper
valueClassis an array.
- to
valueDomainandvalidValuesare non-null, then all valid values shall be contained in the value domain.- Parameters:
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, orInteger.MAX_VALUEif no restriction.valueClass- the class that describes the type of the parameter value.valueDomain- the minimum value, maximum value and unit of measurement, ornullif none.validValues- the list of valid values, ornullif 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, ornullif none.
-
DefaultParameterDescriptor
Creates a new descriptor with the same values as the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.This constructor performs a shallow copy, i.e. the properties are not cloned.
- Parameters:
descriptor- the descriptor to shallow copy.- See Also:
-
-
Method Details
-
castOrCopy
Returns a SIS parameter implementation with the same values as the given arbitrary implementation. If the given object isnull, then this method returnsnull. 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.- Type Parameters:
T- the type of values.- Parameters:
object- the object to get as a SIS implementation, ornullif none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
nullif the argument was null.
-
getStandardType
Returns the GeoAPI interface that defines the contract of this implementation class. This is the base type required byequals(…)methods for returning a potentiallytruevalue.- Specified by:
getStandardTypein interfaceLenientComparable- Overrides:
getStandardTypein classAbstractParameterDescriptor- Returns:
ParameterDescriptor.classor a user-defined sub-interface.- Since:
- 1.7
- See Also:
-
getValueType
Returns the name that describes the type of parameter values. This is closely related to theClassreturned bygetValueClass():- If the value class is a collection (e.g.
Listor array), then this method returns the type of elements in the collection. - Otherwise this method returns the value class using the mapping documented in
DefaultTypeNamejavadoc.
TypeNameis used for encoding parameters in XML or JSON documents, whilegetValueClass()is used for programmatic purposes.- Returns:
- the type name of value component(s) in this parameter.
- Since:
- 1.3
- If the value class is a collection (e.g.
-
getValueClass
Returns the class that describes the type of parameter values.- Specified by:
getValueClassin interfaceParameterDescriptor<T>- Returns:
- the parameter value class.
-
getValidValues
If this parameter allows only a finite set of values, returns that set. The set of valid values is usually a code list or enumeration. This method returnsnullif this parameter does not limit values to a finite set.- Specified by:
getValidValuesin interfaceParameterDescriptor<T>- Returns:
- a finite set of valid values (usually from a code list),
or
nullif it does not apply or if there is no restriction.
-
getValueDomain
Returns the domain of values with their unit of measurement (if any), ornullif none. TheRangeobject combines the value class, minimum value, maximum value and whether these values are inclusive or inclusive. If the range is an instance ofMeasurementRange, then it also contains the unit of measurement.API note
If this method returns a non-null value, then its type is either exactlyRange<T>, orRange<E>where<E>is the component type of<T>(using wrapper classes for primitive types).- Returns:
- the domain of values, or
null. - See Also:
-
getMinimumValue
Returns the minimum parameter value. If there is no minimum value, or if minimum value is inappropriate for the value class, then this method returnsnull.This is a convenience method for
getValueDomain().getMinValue(). Note that this method said nothing about whether the value is inclusive.- Specified by:
getMinimumValuein interfaceParameterDescriptor<T>- Returns:
- the minimum parameter value (often an instance of
Double), ornullif unbounded.
-
getMaximumValue
Returns the maximum parameter value. If there is no maximum value, or if maximum value is inappropriate for the value type, then this method returnsnull.This is a convenience method for
getValueDomain().getMaxValue(). Note that this method said nothing about whether the value is inclusive.- Specified by:
getMaximumValuein interfaceParameterDescriptor<T>- Returns:
- the minimum parameter value (often an instance of
Double), ornullif unbounded.
-
getDefaultValue
Returns the default value for the parameter. The return type can be any type including aNumberor aString. If there is no default value, then this method returnsnull.- Specified by:
getDefaultValuein interfaceParameterDescriptor<T>- Returns:
- the default value, or
nullin none.
-
getUnit
Returns the unit of measurement for the minimum, maximum and default values. If units of measurement are not applicable to values of type<T>, or if the units are unknown, then this method returnsnull.This is a convenience method for
getValueDomain().unit().- Specified by:
getUnitin interfaceParameterDescriptor<T>- Returns:
- the unit of minimum, maximum and default values, or
nullif not applicable. - See Also:
-
createValue
Creates a new parameter value instance initialized with the default value. The parameter descriptor for the created parameter value will bethisobject.- Specified by:
createValuein interfaceGeneralParameterDescriptor- Specified by:
createValuein interfaceParameterDescriptor<T>- Returns:
- a parameter initialized to the default value.
-
equals
Compares the specified object with this parameter for equality. The strictness level is controlled by the second argument. This method compares the following properties in every cases:AbstractIdentifiedObject.getName(), compared heuristically inIGNORE_METADATAor less strict mode.getValueClass()getDefaultValue()getUnit()
ComparisonMode.IGNORE_METADATA.- Specified by:
equalsin interfaceLenientComparable- Overrides:
equalsin classAbstractParameterDescriptor- Parameters:
object- the object to compare tothis.mode- the strictness level of the comparison.- Returns:
trueif both objects are equal according the given comparison mode.- See Also:
-
AbstractIdentifiedObject.getStandardType()for integration withLenientComparable.