Package org.locationtech.jtstest.geomop
Class GeometryFunctionOperation
- java.lang.Object
-
- org.locationtech.jtstest.geomop.GeometryFunctionOperation
-
- All Implemented Interfaces:
GeometryOperation
public class GeometryFunctionOperation extends java.lang.Object implements GeometryOperation
Invokes a function from registry or a Geometry method determined by a named operation with a list of arguments, the first of which is aGeometry
. This class allows overriding Geometry methods or augmenting them with functions defined in aGeometryFunctionRegistry
.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private ArgumentConverter
argConverter
private GeometryOperation
defaultOp
private GeometryFunctionRegistry
registry
-
Constructor Summary
Constructors Constructor Description GeometryFunctionOperation()
GeometryFunctionOperation(GeometryFunctionRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class
getReturnType(java.lang.String opName)
Gets the class of the return type of the given operation.Result
invoke(java.lang.String opName, Geometry geometry, java.lang.Object[] args)
Invokes an operation on aGeometry
.private Result
invoke(GeometryFunction func, Geometry geometry, java.lang.Object[] args)
-
-
-
Field Detail
-
registry
private GeometryFunctionRegistry registry
-
defaultOp
private GeometryOperation defaultOp
-
argConverter
private ArgumentConverter argConverter
-
-
Constructor Detail
-
GeometryFunctionOperation
public GeometryFunctionOperation()
-
GeometryFunctionOperation
public GeometryFunctionOperation(GeometryFunctionRegistry registry)
-
-
Method Detail
-
getReturnType
public java.lang.Class getReturnType(java.lang.String opName)
Description copied from interface:GeometryOperation
Gets the class of the return type of the given operation.- Specified by:
getReturnType
in interfaceGeometryOperation
- Parameters:
opName
- the name of the operation- Returns:
- the class of the return type of the specified operation
-
invoke
public Result invoke(java.lang.String opName, Geometry geometry, java.lang.Object[] args) throws java.lang.Exception
Description copied from interface:GeometryOperation
Invokes an operation on aGeometry
.- Specified by:
invoke
in interfaceGeometryOperation
- Parameters:
opName
- name of the operationgeometry
- the geometry to processargs
- the arguments to the operation (which may be typed as Strings)- Returns:
- the result of the operation
- Throws:
java.lang.Exception
- if some error was encountered trying to find or process the operation
-
invoke
private Result invoke(GeometryFunction func, Geometry geometry, java.lang.Object[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-