public final class MethodHandleUtils extends Object
| Modifier and Type | Method and 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. |
public static Optional<MethodHandle> mayBeMethodHandle(Class<?> klass, String methodName)
MethodHandle for the specified class and method if the method exists.klass - the classmethodName - the method nameOptional for the MethodHandlepublic static MethodHandle methodHandle(Method method) throws IllegalAccessException
MethodHandle for the specified method.method - the methodMethodHandle for the specified methodIllegalAccessException - if the method is not accessiblepublic static MethodHandle methodHandle(Field field) throws IllegalAccessException
MethodHandle for the specified field.field - the fieldMethodHandle for the specified fieldIllegalAccessException - if the method is not accessibleCopyright © 2023. All rights reserved.