Class StaticMethodGeometryFunction

java.lang.Object
org.locationtech.jtstest.geomfunction.BaseGeometryFunction
org.locationtech.jtstest.geomfunction.StaticMethodGeometryFunction
All Implemented Interfaces:
Comparable, GeometryFunction

public class StaticMethodGeometryFunction extends BaseGeometryFunction
A GeometryFunction which calls a static Method.
  • Field Details

  • Constructor Details

    • StaticMethodGeometryFunction

      public StaticMethodGeometryFunction(String category, String name, String description, String[] parameterNames, Class[] parameterTypes, Class returnType, Method method)
  • Method Details

    • createFunction

      public static StaticMethodGeometryFunction createFunction(Method method)
    • extractCategory

      private static String extractCategory(String className)
    • extractParamNames

      private static String[] extractParamNames(Method method)
      Java doesn't permit accessing the original code parameter names, unfortunately.
      Parameters:
      method -
      Returns:
    • defaultParamNames

      private static String[] defaultParamNames(Method method)
    • firstScalarParamIndex

      private static int firstScalarParamIndex(Method method)
    • paramNamePrimary

      private static String paramNamePrimary(Class<?> clz)
    • extractDescription

      private static String extractDescription(Method method)
    • extractParamTypes

      private static Class[] extractParamTypes(Method method)
    • invoke

      public Object invoke(Geometry g, Object[] arg)
      Description copied from interface: GeometryFunction
      Invokes this function. Note that any exceptions returned must be RuntimeExceptions.
      Specified by:
      invoke in interface GeometryFunction
      Specified by:
      invoke in class BaseGeometryFunction
      Parameters:
      g - the target geometry
      arg - the other arguments to the function
      Returns:
      the value computed by the function
    • createFullArgs

      private static Object[] createFullArgs(Geometry g, Object[] arg)
      Creates an arg array which includes the target geometry as the first argument
      Parameters:
      g -
      arg -
      Returns:
    • invoke

      public static Object invoke(Method method, Object target, Object[] args)
    • invocationErrMsg

      private static String invocationErrMsg(InvocationTargetException ex)
    • getClassname

      public static String getClassname(Class javaClass)