Module ojalgo

Class MethodDescriptor

  • All Implemented Interfaces:
    java.io.Serializable

    public final class MethodDescriptor
    extends java.lang.Object
    implements java.io.Serializable
    Description of a (static) method to invoke in a child JVM. Uses type names internally to avoid ClassLoader mismatches.

    In Java, a method is identified for reflective lookup by its name and parameter types only. The return type is not used to resolve a method and cannot disambiguate overloads (two methods cannot differ only by return type).

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodDescriptor​(java.lang.String className, java.lang.String methodName, java.lang.String[] parameterTypeNames)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.reflect.Method getMethod()  
      static MethodDescriptor of​(java.lang.Class<?> owner, java.lang.String name, java.lang.Class<?>... parameters)  
      static MethodDescriptor of​(java.lang.reflect.Method method)
      Create a descriptor from a reflective Method.
      private static java.lang.String[] typeNames​(java.lang.Class<?>[] types)  
      • Methods inherited from class java.lang.Object

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

      • myClassName

        private final java.lang.String myClassName
      • myMethod

        private transient java.lang.reflect.Method myMethod
      • myMethodName

        private final java.lang.String myMethodName
      • myParameterTypeNames

        private final java.lang.String[] myParameterTypeNames
    • Constructor Detail

      • MethodDescriptor

        MethodDescriptor​(java.lang.String className,
                         java.lang.String methodName,
                         java.lang.String[] parameterTypeNames)
    • Method Detail

      • of

        public static MethodDescriptor of​(java.lang.Class<?> owner,
                                          java.lang.String name,
                                          java.lang.Class<?>... parameters)
      • of

        public static MethodDescriptor of​(java.lang.reflect.Method method)
        Create a descriptor from a reflective Method. Parameter types are taken as declared (including varargs represented as an array type). The return type is intentionally not included as it is not used for reflective lookup.

        The method must be static when used with ExternalProcessExecutor.

      • typeNames

        private static java.lang.String[] typeNames​(java.lang.Class<?>[] types)
      • getMethod

        public java.lang.reflect.Method getMethod()
                                           throws java.lang.ClassNotFoundException,
                                                  java.lang.NoSuchMethodException,
                                                  java.lang.SecurityException
        Throws:
        java.lang.ClassNotFoundException
        java.lang.NoSuchMethodException
        java.lang.SecurityException