public class ReflectionUtils
extends java.lang.Object
This class is intented to be used only be JNA itself.
This implementation is inspired by: Correct Reflective Access to Interface Default Methods in Java 8, 9, 10
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Object |
getMethodHandle(java.lang.reflect.Method method)
Retrieve the method handle, that can be used to invoke the provided
method.
|
static java.lang.Object |
invokeDefaultMethod(java.lang.Object target,
java.lang.Object methodHandle,
java.lang.Object... args)
Invokes a default method reflectively.
|
static boolean |
isDefault(java.lang.reflect.Method method)
Check if the supplied method object represents a default method.
|
public static boolean isDefault(java.lang.reflect.Method method)
This is the reflective equivalent of method.isDefault().
method - method is a
default methodpublic static java.lang.Object getMethodHandle(java.lang.reflect.Method method)
throws java.lang.Exception
method - java.lang.Exceptionpublic static java.lang.Object invokeDefaultMethod(java.lang.Object target,
java.lang.Object methodHandle,
java.lang.Object... args)
throws java.lang.Throwable
target - object to invoke the supplied method handle onmethodHandle - retrieved via getMethodHandle(java.lang.reflect.Method)args - java.lang.Throwable