Class ServiceParameter

java.lang.Object
org.apache.sis.internal.simple.SimpleIdentifiedObject
org.apache.sis.internal.jaxb.metadata.replace.ServiceParameter
All Implemented Interfaces:
Serializable, LenientComparable, org.opengis.parameter.GeneralParameterDescriptor, org.opengis.parameter.ParameterDescriptor, org.opengis.referencing.IdentifiedObject

public final class ServiceParameter extends SimpleIdentifiedObject
Parameter information conform to the ISO 19115:2014 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 19115:2014 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 ServiceParameter instances in Apache SIS internal code if all methods creating such instances declare ParameterDescriptor<?> as their return type.
Since:
0.5
Version:
1.3
Author:
Rémi Maréchal (Geomatys), Martin Desruisseaux (Geomatys)
See Also:
  • Method Details

    • castOrCopy

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

      public static org.opengis.util.MemberName getMemberName(org.opengis.parameter.ParameterDescriptor<?> parameter)
      Gets the parameter name as an instance of MemberName. This method performs the following checks:
      • If the
        invalid reference
        primary name
        is an instance of MemberName, returns that primary name.
      • Otherwise this method searches for the first
        invalid reference
        alias
        which is an instance of MemberName. If found, that alias is returned.
      • If no alias is found, then this method tries to build a member name from the primary name and the
        invalid reference
        value type
        (if available) or the value class.
      This method can be used as a bridge between the parameter object defined by ISO 19111 (namely CC_OperationParameter) and the one defined by ISO 19115 (namely SV_Parameter).
      Parameters:
      parameter - the parameter from which to get the name (may be null).
      Returns:
      the member name, or null if none.
    • 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 19115, which is MemberName. This method is the converse of getMemberName(ParameterDescriptor).
      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).
    • getValueType

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

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

      public org.opengis.util.InternationalString getDescription()
      Returns a narrative explanation of the role of the parameter.
      Returns:
      a narrative explanation of the role of the parameter, or null if none.
    • getMinimumOccurs

      public int getMinimumOccurs()
      The minimum number of times that values for this parameter group or parameter are required.
      Returns:
      the minimum occurrence.
    • getMaximumOccurs

      public int getMaximumOccurs()
      The maximum number of times that values for this parameter group or parameter can be included.
      Returns:
      the maximum occurrence.
    • createValue

      public final org.opengis.parameter.ParameterValue createValue()
      Creates a new instance of ParameterValue. This method delegates the work to DefaultParameterDescriptor since this ServiceParameter class is not a full-featured parameter descriptor implementation.
      Specified by:
      createValue in interface org.opengis.parameter.GeneralParameterDescriptor
      Specified by:
      createValue in interface org.opengis.parameter.ParameterDescriptor<T>
      Returns:
      a new instance of ParameterValue.
    • getValidValues

      public Set getValidValues()
      Optional properties.
      Specified by:
      getValidValues in interface org.opengis.parameter.ParameterDescriptor<T>
      Returns:
      null.
    • getMinimumValue

      public Comparable getMinimumValue()
      Specified by:
      getMinimumValue in interface org.opengis.parameter.ParameterDescriptor<T>
    • getMaximumValue

      public Comparable getMaximumValue()
      Specified by:
      getMaximumValue in interface org.opengis.parameter.ParameterDescriptor<T>
    • getDefaultValue

      public Object getDefaultValue()
      Specified by:
      getDefaultValue in interface org.opengis.parameter.ParameterDescriptor<T>
    • getUnit

      public javax.measure.Unit getUnit()
      Specified by:
      getUnit in interface org.opengis.parameter.ParameterDescriptor<T>
    • equals

      public final boolean equals(Object object, ComparisonMode mode)
      Compares this object with the given one for equality. This implementation should be consistent with AbstractIdentifiedObject.equals(Object) implementation, with the simplification that some Parameter property values are always null.
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class SimpleIdentifiedObject
      Parameters:
      object - the object to compare with this reference system.
      mode - the strictness level of the comparison.
      Returns:
      true if both objects are equal.
      See Also: