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. OtherGeometryOperationclasses 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[]convArgprivate 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 booleanconvertArg(java.lang.Class destClass, java.lang.Object srcValue, java.lang.Object[] convArg)private booleanconvertArgFromString(java.lang.Class destClass, java.lang.String srcStr, java.lang.Object[] convArg)private booleanconvertArgs(java.lang.Class[] parameterTypes, java.lang.Object[] args, java.lang.Object[] actualArgs)private java.lang.reflect.MethodgetGeometryMethod(java.lang.String opName, java.lang.Object[] args, java.lang.Object[] actualArgs)static java.lang.ClassgetGeometryReturnType(java.lang.String functionName)java.lang.ClassgetReturnType(java.lang.String opName)Gets the class of the return type of the given operation.Resultinvoke(java.lang.String opName, Geometry geometry, java.lang.Object[] args)Invokes an operation on aGeometry.private ResultinvokeMethod(java.lang.reflect.Method method, Geometry geometry, java.lang.Object[] args)static booleanisBooleanFunction(java.lang.String name)static booleanisDoubleFunction(java.lang.String name)static booleanisGeometryFunction(java.lang.String name)static booleanisIntegerFunction(java.lang.String name)private static intnonNullItemCount(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:GeometryOperationGets the class of the return type of the given operation.- Specified by:
getReturnTypein 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:GeometryOperationInvokes an operation on aGeometry.- Specified by:
invokein 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)
-
-