Package org.github.jamm.utils

# Class MethodHandleUtils

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

public final class MethodHandleUtils extends Object

## Method Summary

Modifier and Type
Method
Description
`static Optional<MethodHandle>`
`mayBeMethodHandle(Class<?> klass, String methodName)`
Returns the `MethodHandle` for the specified class and method if the method exists.
`static MethodHandle`
`methodHandle(Field field)`
Returns the `MethodHandle` for the specified field.
`static MethodHandle`
`methodHandle(Method method)`
Returns the `MethodHandle` for the specified method.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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