Class CC_GeneralOperationParameter
This class provides additional merge(…) methods for building a unique descriptor
instance when the same descriptor is declared in more than one place in the GML document.
Some examples of duplications are:
- The descriptors listed under the
<gml:group>element, which duplicate the descriptors listed under each<gml:parameterValue>element. - The descriptors declared in each parameter value of a
SingleOperation, which duplicate the descriptors declared in the associatedOperationMethod.
- Since:
- 0.6
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortThe default value ofminimumOccursandmaximumOccursif the XML element is not provided.private static final String[]The properties to ignore in the descriptor parsed from GML when this descriptor is merged with a predefined descriptor.Fields inherited from class org.apache.sis.internal.jaxb.gco.PropertyType
metadata -
Constructor Summary
ConstructorsModifierConstructorDescriptionEmpty constructor for JAXB only.privateCC_GeneralOperationParameter(org.opengis.parameter.GeneralParameterDescriptor parameter) Constructor for thewrap(GeneralParameterDescriptor)method only. -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> booleancontainsAll(Collection<T> complete, Collection<T> provided) Returnstrueif thecompletecollection contains all elements in theprovidedcollection, where each element have been converted to the canonicalNamedIdentifierimplementation for comparison purpose.private static <T> org.opengis.parameter.ParameterDescriptor<T>create(Map<String, ?> merged, org.opengis.parameter.ParameterDescriptor<?> provided, org.opengis.parameter.ParameterDescriptor<T> complete) Creates a new descriptor with the same properties than theprovidedone, but completed with information not found in GML.protected Class<org.opengis.parameter.GeneralParameterDescriptor>Returns the GeoAPI interface which is bound by this adapter.Invoked by JAXB at marshalling time for getting the actual element to write inside the<gml:parameter>XML element.private static booleanisRestricted(org.opengis.parameter.ParameterDescriptor<?> descriptor) Returnstrueif the given descriptor is restricted to a constant value.(package private) static org.opengis.parameter.ParameterDescriptorGroupmerge(Class<?> caller, Map<String, ?> properties, Map<String, ?> merged, int minimumOccurs, int maximumOccurs, org.opengis.parameter.GeneralParameterDescriptor[] provided, org.opengis.parameter.ParameterDescriptorGroup complete, boolean canSubstitute) Returns a descriptor with the given properties, completed with information not found in GML.(package private) static org.opengis.parameter.GeneralParameterDescriptormerge(org.opengis.parameter.GeneralParameterDescriptor provided, org.opengis.parameter.GeneralParameterDescriptor complete) Returns a descriptor with the same properties than theprovidedone, but completed with information not found in GML.private static <T> voidmergeArrays(String key, Class<T> componentType, Collection<T> provided, Map<String, Object> merged, org.opengis.metadata.Identifier remove) Merges the property of typeCollectionidentified by the given key.voidsetElement(AbstractParameterDescriptor parameter) Invoked by JAXB at unmarshalling time for storing the result temporarily.private static NamedIdentifiertoNamedIdentifier(Object name) Given anIdentifierorGenericNameinstance, returns that instance as aNamedIdentifierimplementation.(package private) static voidvalidate(org.opengis.parameter.GeneralParameterDescriptor descriptor, String parent, String property) Verifies that the given descriptor is non-null and contains at least a name.protected CC_GeneralOperationParameterwrap(org.opengis.parameter.GeneralParameterDescriptor parameter) Invoked byPropertyTypeat marshalling time for wrapping the given value in a<gml:OperationParameter>or<gml:OperationParameterGroup>XML element.Methods inherited from class org.apache.sis.internal.jaxb.gco.PropertyType
accept2014, getActuate, getArcRole, getHRef, getNilReason, getRole, getShow, getTitle, getUUIDREF, incomplete, marshal, setActuate, setArcRole, setHRef, setNilReason, setRole, setShow, setTitle, setUUIDREF, unmarshal
-
Field Details
-
DEFAULT_OCCURRENCE
public static final short DEFAULT_OCCURRENCEThe default value ofminimumOccursandmaximumOccursif the XML element is not provided.- See Also:
-
IGNORE_DURING_MERGE
The properties to ignore in the descriptor parsed from GML when this descriptor is merged with a predefined descriptor. Remarks:- We ignore the name because the comparisons shall be performed by the caller with
IdentifiedObjects.isHeuristicMatchForName(org.opengis.referencing.IdentifiedObject, java.lang.String)or something equivalent. - We ignore aliases and identifiers because they are collections, which require handling in a special way.
- We ignore the name because the comparisons shall be performed by the caller with
-
-
Constructor Details
-
CC_GeneralOperationParameter
public CC_GeneralOperationParameter()Empty constructor for JAXB only. -
CC_GeneralOperationParameter
private CC_GeneralOperationParameter(org.opengis.parameter.GeneralParameterDescriptor parameter) Constructor for thewrap(GeneralParameterDescriptor)method only.
-
-
Method Details
-
getBoundType
Returns the GeoAPI interface which is bound by this adapter. This method is indirectly invoked by the private constructor below, so it shall not depend on the state of this object.- Specified by:
getBoundTypein classPropertyType<CC_GeneralOperationParameter,org.opengis.parameter.GeneralParameterDescriptor> - Returns:
GeneralParameterDescriptor.class
-
wrap
protected CC_GeneralOperationParameter wrap(org.opengis.parameter.GeneralParameterDescriptor parameter) Invoked byPropertyTypeat marshalling time for wrapping the given value in a<gml:OperationParameter>or<gml:OperationParameterGroup>XML element.- Specified by:
wrapin classPropertyType<CC_GeneralOperationParameter,org.opengis.parameter.GeneralParameterDescriptor> - Parameters:
parameter- the element to marshal.- Returns:
- a
PropertyTypewrapping the given the element.
-
getElement
Invoked by JAXB at marshalling time for getting the actual element to write inside the<gml:parameter>XML element. This is the value or a copy of the value given in argument to thewrapmethod.- Returns:
- the element to be marshalled.
- See Also:
-
setElement
Invoked by JAXB at unmarshalling time for storing the result temporarily.- Parameters:
parameter- the unmarshalled element.
-
validate
static void validate(org.opengis.parameter.GeneralParameterDescriptor descriptor, String parent, String property) Verifies that the given descriptor is non-null and contains at least a name. This method is used after unmarshalling. We do this validation because parameter descriptors are mandatory and SIS classes need them. So we provide an error message here instead of waiting for aNullPointerExceptionto occur in some arbitrary place.- Parameters:
descriptor- the descriptor to validate.parent- the name of the element to report as the parent ofproperty.property- the name of the property to report as missing if an exception is thrown.- Throws:
GeodeticException- if the parameters are missing or invalid.
-
isRestricted
private static boolean isRestricted(org.opengis.parameter.ParameterDescriptor<?> descriptor) Returnstrueif the given descriptor is restricted to a constant value. This constraint exists in some predefined map projections.Example: the "Latitude of natural origin" parameter of "Mercator (1SP)" projection is provided for completeness, but should never be different than zero in this particular projection (otherwise it would be a "Mercator (variant C)" projection). But if this parameter is nevertheless provided, the SIS implementation will use it. From this point of view, SIS is tolerant to non-zero value.If the GML document declares explicitly a restricted parameter, maybe it intends to use it with a non-zero value. Consequently, the
merge(…)method will not propagate this restriction. -
merge
static org.opengis.parameter.GeneralParameterDescriptor merge(org.opengis.parameter.GeneralParameterDescriptor provided, org.opengis.parameter.GeneralParameterDescriptor complete) Returns a descriptor with the same properties than theprovidedone, but completed with information not found in GML. Those missing information are given by thecompletedescriptor, which may come from two sources:- The descriptor for a
<gml:ParameterValue>element. Those descriptors are more complete than the ones provided by<gml:OperationParameter>elements alone because the parameter value allows SIS to infer thevalueClass. - A predefined parameter descriptor from the
org.apache.sis.internal.referencing.providerpackage.
- Parameters:
provided- the descriptor unmarshalled from the GML document.complete- the descriptor to use for completing missing information.- Returns:
- the descriptor to use. May be one of the arguments given to this method, or a new instance.
- See Also:
- The descriptor for a
-
merge
static org.opengis.parameter.ParameterDescriptorGroup merge(Class<?> caller, Map<String, ?> properties, Map<String, ?> merged, int minimumOccurs, int maximumOccurs, org.opengis.parameter.GeneralParameterDescriptor[] provided, org.opengis.parameter.ParameterDescriptorGroup complete, boolean canSubstitute) Returns a descriptor with the given properties, completed with information not found in GML. Those extra information are given by thecompletedescriptor.- Parameters:
caller- the public source class to report if a log message need to be emitted.properties- properties as declared in the GML document, to be used ifcompleteis incompatible.merged- more complete properties, to be used ifcompleteis compatible.minimumOccurs- value to assign toAbstractParameterDescriptor.getMinimumOccurs().maximumOccurs- value to assign toAbstractParameterDescriptor.getMaximumOccurs().provided- parameter descriptors declared in the GML document. This array will be overwritten.complete- more complete parameter descriptors.canSubstitute-trueif this method is allowed to returncomplete.- Returns:
- the parameter descriptor group to use (may be the
completeinstance). - See Also:
-
create
private static <T> org.opengis.parameter.ParameterDescriptor<T> create(Map<String, ?> merged, org.opengis.parameter.ParameterDescriptor<?> provided, org.opengis.parameter.ParameterDescriptor<T> complete) Creates a new descriptor with the same properties than theprovidedone, but completed with information not found in GML. Those extra information are given by thecompletedescriptor.It is the caller's responsibility to construct the
mergedproperties as a merge of the properties of the two given descriptors. This can be done with the help ofmergeArrays(String, Class, Collection, Map, Identifier)among others. -
containsAll
Returnstrueif thecompletecollection contains all elements in theprovidedcollection, where each element have been converted to the canonicalNamedIdentifierimplementation for comparison purpose.- Type Parameters:
T- the type of elements in the collection.- Parameters:
complete- the collection which is expected to contains all elements.provided- the collection which may be a subset ofcomplete.- Returns:
trueifcompletecontains allprovidedelements.
-
mergeArrays
private static <T> void mergeArrays(String key, Class<T> componentType, Collection<T> provided, Map<String, Object> merged, org.opengis.metadata.Identifier remove) Merges the property of typeCollectionidentified by the given key. This is used when we cannot just substitute one collection by the other.- Type Parameters:
T- the type of elements in the array or collection.- Parameters:
key- the key where to fetch or store the array in themergedmap.componentType- the type of elements in the array or collection.provided- the elements unmarshalled from the XML document.merged- the map used for completing missing information.
-
toNamedIdentifier
Given anIdentifierorGenericNameinstance, returns that instance as aNamedIdentifierimplementation. The intent is to allowObject.equals(Object)and hash code to correctly recognize two names or identifiers as equal even if they are of different implementations.Note that
NamedIdentifieris the type of unmarshalled names, aliases and identifiers. So this method should not create any new object in a majority of cases.
-