- All Superinterfaces:
IdentifiedType,PropertyType
@Classifier(METACLASS)
@UML(identifier="Operation",
specification=ISO_19109)
public interface Operation
extends PropertyType
Describes the behaviour of a feature type as a function or a method.
Operations can:
- Compute values from the attributes.
- Perform actions that change the attribute values.
Example: a mutator operation may raise the height of a dam. This changes
may affect other properties like the watercourse and the reservoir associated with the dam.
This Operation type is used for defining the required parameters and expected result.- Since:
- 3.1
-
Method Summary
Modifier and TypeMethodDescriptionapply(Feature feature, ParameterValueGroup parameters) Executes the operation on the specified feature with the specified parameters.Returns a description of the input parameters.Returns the expected result type, ornullif none.Methods inherited from interface org.opengis.feature.IdentifiedType
getDefinition, getDescription, getDesignation, getName
-
Method Details
-
getParameters
@UML(identifier="signature", obligation=MANDATORY, specification=ISO_19109) ParameterDescriptorGroup getParameters()Returns a description of the input parameters.- Returns:
- description of the input parameters.
-
getResult
@UML(identifier="signature", obligation=MANDATORY, specification=ISO_19109) IdentifiedType getResult()Returns the expected result type, ornullif none.- Returns:
- the type of the result, or
nullif none.
-
apply
Executes the operation on the specified feature with the specified parameters. Theparametersargument should be an instance created like below, where the text in italic shall be replaced by operation-specific text:The value returned by this method depends on the value returned byParameterValueGroup p = operation.getParameters().createValue(); p.parameter("a parameter 1").setValue(aValue1); p.parameter("a parameter 2").setValue(aValue2);getResult():- If
getResult()returnsnull, then this method should returnnull. - If
getResult()returns an instance ofAttributeType, then this method shall return an instance ofAttributeand theAttribute.getType() == getResult()relation should hold. - If
getResult()returns an instance ofFeatureAssociationRole, then this method shall return an instance ofFeatureAssociationand theFeatureAssociation.getRole() == getResult()relation should hold.
Analogy with Java reflection: if we compareOperationtoMethodin the Java language, then this method is equivalent toMethod.invoke(Object, Object...). TheFeatureargument is equivalent tothisin the Java language, and may benullif the operation does not need a feature instance (like static methods in the Java language).API note: the method signature is compatible withBiFunction<Feature, ParameterValueGroup, Property>from thejava.util.functionpackage.- Parameters:
feature- the feature on which to execute the operation. Can benullif the operation does not need feature instance.parameters- the parameters to use for executing the operation. Can benullif the operation does not take any parameters.- Returns:
- the operation result, or
nullif this operation does not produce any result. - Throws:
FeatureOperationException- if the operation cannot complete.
- If
-