Class 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 a Geometry. This class provides operations which are the methods defined on the Geometry class. Other GeometryOperation 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  
    • 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 a Geometry.
      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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • geometryMethods

        private java.lang.reflect.Method[] geometryMethods
      • convArg

        private java.lang.Object[] convArg
    • Constructor Detail

      • GeometryMethodOperation

        public GeometryMethodOperation()
    • 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 interface GeometryOperation
        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 a Geometry.
        Specified by:
        invoke in interface GeometryOperation
        Parameters:
        opName - name of the operation
        geometry - the geometry to process
        args - 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)
      • invokeMethod

        private Result invokeMethod​(java.lang.reflect.Method method,
                                    Geometry geometry,
                                    java.lang.Object[] args)
                             throws java.lang.Exception
        Throws:
        java.lang.Exception