Class ServiceParameter

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

public final class ServiceParameter extends Parameter
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
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) org.opengis.util.InternationalString
    A narrative explanation of the role of the parameter.
    (package private) org.opengis.util.MemberName
    The name, as used by the service for this parameter.
    (package private) boolean
    Indication if the parameter is required.
    (package private) boolean
    Indication if more than one value of the parameter may be provided.

    Fields inherited from class org.apache.sis.internal.simple.SimpleIdentifiedObject

    name

    Fields inherited from interface org.opengis.referencing.IdentifiedObject

    ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    (package private)
    Creates an initially empty parameter.
    private
    ServiceParameter(org.opengis.parameter.ParameterDescriptor<?> parameter)
    Creates a parameter initialized to the values of the given one.
  • Method Summary

    Modifier and Type
    Method
    Description
    castOrCopy(org.opengis.parameter.ParameterDescriptor<?> parameter)
    Returns the given parameter as an instance of ServiceParameter.
    org.opengis.util.InternationalString
    Returns a narrative explanation of the role of the parameter.
    Returns the name to be marshalled in the ISO 19139:2007 way.
    private org.opengis.util.TypeName
    For JAXB marshalling of ISO 19139:2007 document only.
    int
    The maximum number of times that values for this parameter group or parameter can be included.
    static org.opengis.util.MemberName
    getMemberName(org.opengis.parameter.ParameterDescriptor<?> parameter)
    Gets the parameter name as an instance of MemberName.
    int
    The minimum number of times that values for this parameter group or parameter are required.
    org.opengis.referencing.ReferenceIdentifier
    Returns the name as an Identifier, which is the type requested by ISO 19111.
    (package private) final Boolean
    Returns the optionality as a boolean (ISO 19115-3:2016 way).
    (package private) final String
    Returns "Optional" if optionality is true or "Mandatory" otherwise.
    Infers the value class from the attribute type.
    org.opengis.util.TypeName
    Returns the name that describes the type of parameter values.
    private void
    Sets the value from the <gco:aName> (legacy ISO 19139:2007 format).
    (package private) final void
    Sets whether this parameter is optional.
    (package private) final void
    Sets whether this parameter is optional.

    Methods inherited from class org.apache.sis.internal.jaxb.metadata.replace.Parameter

    createValue, equals, getDefaultValue, getMaximumValue, getMinimumValue, getUnit, getValidValues

    Methods inherited from class org.apache.sis.internal.simple.SimpleIdentifiedObject

    equals, getAlias, getDomainOfValidity, getIdentifiers, getRemarks, getScope, hashCode, toString, toWKT

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opengis.referencing.IdentifiedObject

    getAlias, getIdentifiers, getRemarks, toWKT
  • Field Details

    • memberName

      org.opengis.util.MemberName memberName
      The name, as used by the service for this parameter. Note that in ISO 19115-3:2016, this element is inside a <gco:MemberName> element (i.e. ISO inserts the same kind of Property_Type element as it does for all other attributes) while in ISO 19139:2007 it was not (i.e. name attributes like <gco:aName> were marshalled directly, without wrapper). Example:
      See Also:
    • description

      org.opengis.util.InternationalString description
      A narrative explanation of the role of the parameter.
      See Also:
    • optionality

      boolean optionality
      Indication if the parameter is required.
      • In ISO 19115-3:2016, this is represented by "true" or "false".
      • In ISO 19139:2007, this was marshalled as "Optional" or "Mandatory".
      See Also:
    • repeatability

      boolean repeatability
      Indication if more than one value of the parameter may be provided.
      See Also:
  • Constructor Details

    • ServiceParameter

      ServiceParameter()
      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.

    • ServiceParameter

      private ServiceParameter(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 19115 parameter.
      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 primary name is an instance of MemberName, returns that primary name.
      • Otherwise this method searches for the first 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 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).
    • getLegacyName

      private DefaultMemberName getLegacyName()
      Returns the name to be marshalled in the ISO 19139:2007 way. Example:
      Returns:
      the name if marshalling legacy ISO 19139:2007 format, or null otherwise.
    • setLegacyName

      private void setLegacyName(DefaultMemberName value)
      Sets the value from the <gco:aName> (legacy ISO 19139:2007 format). This method is called at unmarshalling-time by JAXB.
      Parameters:
      value - the new name.
      Throws:
      IllegalStateException - if a name is already defined.
    • getLegacyValueType

      private org.opengis.util.TypeName getLegacyValueType()
      For JAXB marshalling of ISO 19139:2007 document only. Note that there is not setter method, because we expect that the same information is provided in the memberName attribute type.
    • 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.
    • 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
      Overrides:
      getValueClass in class Parameter
      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.
    • getOptionality

      final Boolean getOptionality()
      Returns the optionality as a boolean (ISO 19115-3:2016 way).
    • setOptionality

      final void setOptionality(Boolean optional)
      Sets whether this parameter is optional.
    • getOptionalityLabel

      final String getOptionalityLabel()
      Returns "Optional" if optionality is true or "Mandatory" otherwise. This is the legacy ISO 19139:2007 way to marshal optionality.
    • setOptionalityLabel

      final void setOptionalityLabel(String optional)
      Sets whether this parameter is optional.
    • 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.