Class MethodHandleUtils

java.lang.Object
org.github.jamm.utils.MethodHandleUtils

public final class MethodHandleUtils extends Object
  • Method Details

    • mayBeMethodHandle

      public static Optional<MethodHandle> mayBeMethodHandle(Class<?> klass, String methodName)
      Returns the MethodHandle for the specified class and method if the method exists.
      Parameters:
      klass - the class
      methodName - the method name
      Returns:
      an Optional for the MethodHandle
    • methodHandle

      public static MethodHandle methodHandle(Method method) throws IllegalAccessException
      Returns the MethodHandle for the specified method.
      Parameters:
      method - the method
      Returns:
      the MethodHandle for the specified method
      Throws:
      IllegalAccessException - if the method is not accessible
    • methodHandle

      public static MethodHandle methodHandle(Field field) throws IllegalAccessException
      Returns the MethodHandle for the specified field.
      Parameters:
      field - the field
      Returns:
      the MethodHandle for the specified field
      Throws:
      IllegalAccessException - if the method is not accessible