Class QualityParameter

All Implemented Interfaces:
Serializable, LenientComparable, org.opengis.parameter.GeneralParameterDescriptor, org.opengis.parameter.ParameterDescriptor, org.opengis.referencing.IdentifiedObject

public final class QualityParameter extends Parameter
Parameter information conform to the ISO 19157:2013 specification. GeoAPI tries to provides a single API for the parameter classes defined in various specifications (ISO 19111, ISO 19115, ISO 19157, Web Processing Service). But we still need separated representations at XML (un)marshalling time. This class is for the ISO 19157:2013 case.

Note that this implementation is simple and serves no other purpose than being a container for XML parsing and formatting. For real parameter framework, consider using org.apache.sis.parameter package instead.

Note about raw-type usage

We use raw type (i.e. we implement ParameterDescriptor instead of ParameterDescriptor<T>) because there is no way we can know <T> for sure at unmarshalling time. This is not a recommended practice, so this class shall not be in public API. However, it should be okay to create QualityParameter instances in Apache SIS internal code if all methods creating such instances declare ParameterDescriptor<?> as their return type.
Since:
1.3
Version:
1.3
See Also:
  • Field Details

    • code

      String code
      Name of the data quality parameter, to be represented as identifier code.
      See Also:
    • definition

      org.opengis.util.InternationalString definition
      Definition of the data quality parameter. Stored in Identifier#getDescription().
      See Also:
    • description

      Description of the data quality parameter.
      See Also:
      • #getDescription()
    • valueType

      org.opengis.util.TypeName valueType
      Value type of the data quality parameter (shall be one of the data types defined in ISO/TS 19103:2005).
      See Also:
  • Constructor Details

    • QualityParameter

      QualityParameter()
      Creates an initially empty parameter. This constructor is needed by JAXB at unmarshalling time.

      Consider this constructor as private except for testing purpose. See Note about raw-type usage in class javadoc.

    • QualityParameter

      private QualityParameter(org.opengis.parameter.ParameterDescriptor<?> parameter)
      Creates a parameter initialized to the values of the given one. This is used for marshalling an arbitrary parameter as an ISO 19157 parameter.
  • Method Details

    • castOrCopy

      public static QualityParameter castOrCopy(org.opengis.parameter.ParameterDescriptor<?> parameter)
      Returns the given parameter as an instance of QualityParameter.
      Parameters:
      parameter - the parameter (may be null).
      Returns:
      the service parameter, or null if the given argument was null.
    • getMinimumOccurs

      public int getMinimumOccurs()
    • getMaximumOccurs

      public int getMaximumOccurs()
    • getName

      public org.opengis.referencing.ReferenceIdentifier getName()
      Returns the name as an Identifier, which is the type requested by ISO 19111. Note that this is different than the type requested by ISO 19157, which is String.
      Specified by:
      getName in interface org.opengis.referencing.IdentifiedObject
      Overrides:
      getName in class SimpleIdentifiedObject
      Returns:
      the parameter name as an identifier (the type specified by ISO 19111).
    • getValueClass

      public Class<?> getValueClass()
      Infers the value class from the type name. This method is the reason why we cannot parameterize this QualityParameter class (see Note about raw-type usage in class javadoc), because there is no way we can ensure that the class inferred from valueType is really for type <T>.
      Specified by:
      getValueClass in interface org.opengis.parameter.ParameterDescriptor
      Overrides:
      getValueClass in class Parameter
      Returns:
      the value class inferred from the attribute type, or null if unknown.
    • getValueType

      public org.opengis.util.TypeName getValueType()
      Returns the name that describes the type of parameter values.
      Overrides:
      getValueType in class Parameter
      Returns:
      the type name of value component(s) in this parameter.
    • getValueType

      public static org.opengis.util.TypeName getValueType(Class<?> valueClass)
      Suggests a type name for the components of given collection or array class. The component type is fetched on a best effort basis only. This method does the following checks:
      • If the given class is a class, then its component type is used.
      • Otherwise if the class is an Iterable, then the upper bound of elements is fetched.
      • Otherwise if the class is a Map, then the upper bound of keys is fetched.
      • Otherwise if the class is a Matrix or Coverage, then Double components is assumed.
      • Otherwise the given class is used as if it was already a component type (i.e. a singleton item).
      Parameters:
      valueClass - the type of values for which to infer a TypeName instance.
      Returns:
      a type name for components of the given type.