public class NativeInvocationHandler
extends java.lang.Object
implements java.lang.reflect.InvocationHandler
Constructor and Description |
---|
NativeInvocationHandler(Library library,
java.lang.Class<?> interfaceClass,
java.util.Map<LibraryOption,?> optionsMap)
Creates a new InvocationHandler instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
invoke(java.lang.Object self,
java.lang.reflect.Method method,
java.lang.Object[] argArray) |
static <T> T |
wrapInterface(Library library,
java.lang.Class<T> interfaceClass,
java.util.Map<LibraryOption,?> optionsMap)
Creates a new InvocationHandler mapping methods in the interfaceClass
to functions in the native library.
|
public NativeInvocationHandler(Library library, java.lang.Class<?> interfaceClass, java.util.Map<LibraryOption,?> optionsMap)
library
- the native library to callinterfaceClass
- the interface that defines the methods in the
native library that will be accessed via this handler.optionsMap
- a dictionary of options to apply to this library.public static <T> T wrapInterface(Library library, java.lang.Class<T> interfaceClass, java.util.Map<LibraryOption,?> optionsMap)
T
- the type of interfaceClasslibraryName
- the native library to loadinterfaceClass
- the interface that contains the native method descriptionoptionsMap
- a dictionary of options to apply to this library.public java.lang.Object invoke(java.lang.Object self, java.lang.reflect.Method method, java.lang.Object[] argArray) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable