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.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
ConstructorsModifierConstructorDescription(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 TypeMethodDescriptionstatic ServiceParameter
castOrCopy
(org.opengis.parameter.ParameterDescriptor<?> parameter) Returns the given parameter as an instance ofServiceParameter
.org.opengis.util.InternationalString
Returns a narrative explanation of the role of the parameter.private DefaultMemberName
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 ofMemberName
.int
The minimum number of times that values for this parameter group or parameter are required.org.opengis.referencing.ReferenceIdentifier
getName()
Returns the name as anIdentifier
, 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
Class
<?> Infers the value class from the attribute type.org.opengis.util.TypeName
Returns the name that describes the type of parameter values.private void
setLegacyName
(DefaultMemberName value) Sets the value from the<gco:aName>
(legacy ISO 19139:2007 format).(package private) final void
setOptionality
(Boolean optional) Sets whether this parameter is optional.(package private) final void
setOptionalityLabel
(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, 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 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_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 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
".
- See Also:
- 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
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 ofMemberName
. This method performs the following checks:- If the
invalid reference
primary name
MemberName
, returns that primary name. - Otherwise this method searches for the first
invalid reference
alias
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
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
null
if none.
- If the
-
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:
getName
in interfaceorg.opengis.referencing.IdentifiedObject
- Overrides:
getName
in 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
null
otherwise.
-
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 thememberName
attribute type. -
getValueType
public org.opengis.util.TypeName getValueType()Returns the name that describes the type of parameter values.- Overrides:
getValueType
in 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 thisServiceParameter
class (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:
getValueClass
in interfaceorg.opengis.parameter.ParameterDescriptor
- Overrides:
getValueClass
in classParameter
- 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
Returns the optionality as a boolean (ISO 19115-3:2016 way). -
setOptionality
Sets whether this parameter is optional. -
getOptionalityLabel
Returns"Optional"
ifoptionality
istrue
or"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.
-