com.kenai.jaffl.provider
Class NativeInvocationHandler
java.lang.Object
com.kenai.jaffl.provider.NativeInvocationHandler
- All Implemented Interfaces:
- InvocationHandler
public class NativeInvocationHandler
- extends Object
- implements InvocationHandler
InvocationHandler used to map invocations on a java interface to the
correct native function.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NativeInvocationHandler
public NativeInvocationHandler(Library library,
Class<?> interfaceClass,
Map<LibraryOption,?> optionsMap)
- Creates a new InvocationHandler instance.
- Parameters:
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.
wrapInterface
public static <T> T wrapInterface(Library library,
Class<T> interfaceClass,
Map<LibraryOption,?> optionsMap)
- Creates a new InvocationHandler mapping methods in the interfaceClass
to functions in the native library.
- Type Parameters:
T
- the type of interfaceClass- Parameters:
libraryName
- the native library to loadinterfaceClass
- the interface that contains the native method descriptionoptionsMap
- a dictionary of options to apply to this library.
- Returns:
- a new instance of interfaceClass that can be used to call
functions in the native library.
invoke
public Object invoke(Object self,
Method method,
Object[] argArray)
throws Throwable
- Specified by:
invoke
in interface InvocationHandler
- Throws:
Throwable
Copyright © 2011. All Rights Reserved.