Class ServiceParameter
java.lang.Object
org.apache.sis.internal.simple.SimpleIdentifiedObject
org.apache.sis.internal.jaxb.metadata.replace.Parameter
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
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 implementParameterDescriptor 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
FieldsModifier and TypeFieldDescription(package private) org.opengis.util.InternationalStringA narrative explanation of the role of the parameter.(package private) org.opengis.util.MemberNameThe name, as used by the service for this parameter.(package private) booleanIndication if the parameter is required.(package private) booleanIndication if more than one value of the parameter may be provided.Fields inherited from class org.apache.sis.internal.simple.SimpleIdentifiedObject
nameFields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)Creates an initially empty parameter.privateServiceParameter(org.opengis.parameter.ParameterDescriptor<?> parameter) Creates a parameter initialized to the values of the given one. -
Method Summary
Modifier and TypeMethodDescriptionstatic ServiceParametercastOrCopy(org.opengis.parameter.ParameterDescriptor<?> parameter) Returns the given parameter as an instance ofServiceParameter.org.opengis.util.InternationalStringReturns a narrative explanation of the role of the parameter.private DefaultMemberNameReturns the name to be marshalled in the ISO 19139:2007 way.private org.opengis.util.TypeNameFor JAXB marshalling of ISO 19139:2007 document only.intThe maximum number of times that values for this parameter group or parameter can be included.static org.opengis.util.MemberNamegetMemberName(org.opengis.parameter.ParameterDescriptor<?> parameter) Gets the parameter name as an instance ofMemberName.intThe minimum number of times that values for this parameter group or parameter are required.org.opengis.referencing.ReferenceIdentifiergetName()Returns the name as anIdentifier, which is the type requested by ISO 19111.(package private) final BooleanReturns the optionality as a boolean (ISO 19115-3:2016 way).(package private) final StringClass<?>Infers the value class from the attribute type.org.opengis.util.TypeNameReturns the name that describes the type of parameter values.private voidsetLegacyName(DefaultMemberName value) Sets the value from the<gco:aName>(legacy ISO 19139:2007 format).(package private) final voidsetOptionality(Boolean optional) Sets whether this parameter is optional.(package private) final voidsetOptionalityLabel(String optional) Sets whether this parameter is optional.Methods inherited from class org.apache.sis.internal.jaxb.metadata.replace.Parameter
createValue, equals, getDefaultValue, getMaximumValue, getMinimumValue, getUnit, getValidValuesMethods inherited from class org.apache.sis.internal.simple.SimpleIdentifiedObject
equals, getAlias, getDomainOfValidity, getIdentifiers, getRemarks, getScope, hashCode, toString, toWKTMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getRemarks, toWKT
-
Field Details
-
memberName
org.opengis.util.MemberName memberNameThe 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 ofProperty_Typeelement 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 descriptionA narrative explanation of the role of the parameter.- See Also:
-
optionality
boolean optionalityIndication 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".
- In ISO 19115-3:2016, this is represented by "
-
repeatability
boolean repeatabilityIndication 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
Returns the given parameter as an instance ofServiceParameter.- Parameters:
parameter- the parameter (may benull).- Returns:
- the service parameter, or
nullif 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 ofMemberName. 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.
CC_OperationParameter) and the one defined by ISO 19115 (namelySV_Parameter).- Parameters:
parameter- the parameter from which to get the name (may benull).- Returns:
- the member name, or
nullif none.
- If the primary name is an instance of
-
getName
public org.opengis.referencing.ReferenceIdentifier getName()Returns the name as anIdentifier, which is the type requested by ISO 19111. Note that this is different than the type requested by ISO 19115, which isMemberName. This method is the converse ofgetMemberName(ParameterDescriptor).- Specified by:
getNamein interfaceorg.opengis.referencing.IdentifiedObject- Overrides:
getNamein classSimpleIdentifiedObject- Returns:
- the parameter name as an identifier (the type specified by ISO 19111).
-
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
nullotherwise.
-
setLegacyName
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 thememberNameattribute type. -
getValueType
public org.opengis.util.TypeName getValueType()Returns the name that describes the type of parameter values.- Overrides:
getValueTypein classParameter- Returns:
- the type name of value component(s) in this parameter.
-
getValueClass
Infers the value class from the attribute type. This method is the reason why we cannot parameterize thisServiceParameterclass (see Note about raw-type usage in class javadoc), because there is no way we can ensure that the class inferred fromMemberName.getAttributeType()is really for type<T>.- Specified by:
getValueClassin interfaceorg.opengis.parameter.ParameterDescriptor- Overrides:
getValueClassin classParameter- Returns:
- the value class inferred from the attribute type, or
nullif 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
nullif none.
-
getOptionality
Returns the optionality as a boolean (ISO 19115-3:2016 way). -
setOptionality
Sets whether this parameter is optional. -
getOptionalityLabel
Returns"Optional"ifoptionalityistrueor"Mandatory"otherwise. This is the legacy ISO 19139:2007 way to marshal optionality. -
setOptionalityLabel
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.
-