Package org.locationtech.jtstest.geomop
Class GeometryMethodOperation
- java.lang.Object
-
- org.locationtech.jtstest.geomop.GeometryMethodOperation
-
- All Implemented Interfaces:
GeometryOperation
public class GeometryMethodOperation extends java.lang.Object implements GeometryOperation
Invokes a named operation on a set of arguments, the first of which is aGeometry
. This class provides operations which are the methods defined on the Geometry class. OtherGeometryOperation
classes can delegate to instances of this class to run standard Geometry methods.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]
convArg
private java.lang.reflect.Method[]
geometryMethods
-
Constructor Summary
Constructors Constructor Description GeometryMethodOperation()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
convertArg(java.lang.Class destClass, java.lang.Object srcValue, java.lang.Object[] convArg)
private boolean
convertArgFromString(java.lang.Class destClass, java.lang.String srcStr, java.lang.Object[] convArg)
private boolean
convertArgs(java.lang.Class[] parameterTypes, java.lang.Object[] args, java.lang.Object[] actualArgs)
private java.lang.reflect.Method
getGeometryMethod(java.lang.String opName, java.lang.Object[] args, java.lang.Object[] actualArgs)
static java.lang.Class
getGeometryReturnType(java.lang.String functionName)
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
invokeMethod(java.lang.reflect.Method method, Geometry geometry, java.lang.Object[] args)
static boolean
isBooleanFunction(java.lang.String name)
static boolean
isDoubleFunction(java.lang.String name)
static boolean
isGeometryFunction(java.lang.String name)
static boolean
isIntegerFunction(java.lang.String name)
private static int
nonNullItemCount(java.lang.Object[] obj)
-
-
-
Method Detail
-
isBooleanFunction
public static boolean isBooleanFunction(java.lang.String name)
-
isIntegerFunction
public static boolean isIntegerFunction(java.lang.String name)
-
isDoubleFunction
public static boolean isDoubleFunction(java.lang.String name)
-
isGeometryFunction
public static boolean isGeometryFunction(java.lang.String name)
-
getGeometryReturnType
public static java.lang.Class getGeometryReturnType(java.lang.String functionName)
-
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
-
getGeometryMethod
private java.lang.reflect.Method getGeometryMethod(java.lang.String opName, java.lang.Object[] args, java.lang.Object[] actualArgs)
-
nonNullItemCount
private static int nonNullItemCount(java.lang.Object[] obj)
-
convertArgs
private boolean convertArgs(java.lang.Class[] parameterTypes, java.lang.Object[] args, java.lang.Object[] actualArgs)
-
convertArg
private boolean convertArg(java.lang.Class destClass, java.lang.Object srcValue, java.lang.Object[] convArg)
-
convertArgFromString
private boolean convertArgFromString(java.lang.Class destClass, java.lang.String srcStr, java.lang.Object[] convArg)
-
-