Package org.github.jamm.utils
Class MethodHandleUtils
java.lang.Object
org.github.jamm.utils.MethodHandleUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<MethodHandle>
mayBeMethodHandle
(Class<?> klass, String methodName) Returns theMethodHandle
for the specified class and method if the method exists.static MethodHandle
methodHandle
(Field field) Returns theMethodHandle
for the specified field.static MethodHandle
methodHandle
(Method method) Returns theMethodHandle
for the specified method.
-
Method Details
-
mayBeMethodHandle
Returns theMethodHandle
for the specified class and method if the method exists.- Parameters:
klass
- the classmethodName
- the method name- Returns:
- an
Optional
for theMethodHandle
-
methodHandle
Returns theMethodHandle
for the specified method.- Parameters:
method
- the method- Returns:
- the
MethodHandle
for the specified method - Throws:
IllegalAccessException
- if the method is not accessible
-
methodHandle
Returns theMethodHandle
for the specified field.- Parameters:
field
- the field- Returns:
- the
MethodHandle
for the specified field - Throws:
IllegalAccessException
- if the method is not accessible
-