Callback closure.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private static class | CallbackReference.NativeFunctionHandler
Provide invocation handling for an auto-generated Java interface proxy for a native function pointer. |
| private static interface |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Map | |
| pack-priv static final Map | |
| pack-priv Pointer | |
| private static final Map | |
| pack-priv CallbackProxy |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static synchronized native Pointer | createNativeCallback(CallbackProxy callback, Method method, Class<T>[] parameterTypes, Class<T> returnType, int callingConvention)
Create a native trampoline to delegate execution to the Java callback. |
| protected void | |
| private static synchronized native void | |
| public static Callback | |
| private Callback | |
| private static Class | |
| private static Method | |
| public static Pointer | getFunctionPointer(Callback cb)
Return a |
| private static Pointer | |
| private Class | |
| public Pointer | |
| private static boolean |
| altCallbackMap | back to summary |
|---|---|
| pack-priv static final Map<K, V> altCallbackMap | |
| callbackMap | back to summary |
|---|---|
| pack-priv static final Map<K, V> callbackMap | |
| cbstruct | back to summary |
|---|---|
| pack-priv Pointer cbstruct | |
| nativeStrings | back to summary |
|---|---|
| private static final Map<K, V> nativeStrings | |
| proxy | back to summary |
|---|---|
| pack-priv CallbackProxy proxy | |
| CallbackReference | back to summary |
|---|---|
| private CallbackReference(Callback callback, int callingConvention) | |
| createNativeCallback | back to summary |
|---|---|
| private static synchronized native Pointer createNativeCallback(CallbackProxy callback, Method method, Class<T>[] parameterTypes, Class<T> returnType, int callingConvention) Create a native trampoline to delegate execution to the Java callback. | |
| finalize | back to summary |
|---|---|
| protected void finalize() Overrides java. Free native resources associated with this callback. | |
| freeNativeCallback | back to summary |
|---|---|
| private static synchronized native void freeNativeCallback(long ptr) Free the given callback trampoline. | |
| getCallback | back to summary |
|---|---|
| public static Callback getCallback(Class<T> type, Pointer p) Return a Callback associated with the given function pointer. If the pointer refers to a Java callback trampoline, return the original Java Callback. Otherwise, return a proxy to the native function pointer. | |
| getCallback | back to summary |
|---|---|
| private Callback getCallback() | |
| getCallbackClass | back to summary |
|---|---|
| private static Class | |
| getCallbackMethod | back to summary |
|---|---|
| private static Method getCallbackMethod(Callback callback) | |
| getFunctionPointer | back to summary |
|---|---|
| public static Pointer getFunctionPointer(Callback cb) Return a | |
| getNativeFunctionPointer | back to summary |
|---|---|
| private static Pointer getNativeFunctionPointer(Callback cb) | |
| getNativeType | back to summary |
|---|---|
| private Class | |
| getTrampoline | back to summary |
|---|---|
| public Pointer getTrampoline() Obtain a pointer to the native glue code for this callback. | |
| isAllowableNativeType | back to summary |
|---|---|
| private static boolean isAllowableNativeType(Class<T> cls) Returns whether the given class is supported in native code. Other types (String, WString, Structure, arrays, NativeMapped, etc) are supported in the Java library. | |
| Modifier and Type | Field and Description |
|---|---|
| private Method | |
| private FromNativeConverter[] | |
| private ToNativeConverter |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| private Object | |
| private Object | convertArgument(Object value, Class<T> dstType)
Convert argument from its basic native type to the given Java parameter type. |
| private Object | |
| public Class | getParameterTypes()
Implements com. |
| public Class | getReturnType()
Implements com. |
| callbackMethod | back to summary |
|---|---|
| private Method callbackMethod | |
| fromNative | back to summary |
|---|---|
| private FromNativeConverter[] fromNative | |
| toNative | back to summary |
|---|---|
| private ToNativeConverter toNative | |
| DefaultCallbackProxy | back to summary |
|---|---|
| public DefaultCallbackProxy(Method callbackMethod, TypeMapper mapper) | |
| callback | back to summary |
|---|---|
| public Object callback(Object[] args) Implements com. Called from native code. All arguments are in an array of Object as the first argument. Converts all arguments to types required by the actual callback method signature, and converts the result back into an appropriate native type. This method must not throw exceptions. | |
| callback_inner | back to summary |
|---|---|
| private Object callback_inner(Object[] args) | |
| convertArgument | back to summary |
|---|---|
| private Object convertArgument(Object value, Class<T> dstType) Convert argument from its basic native type to the given Java parameter type. | |
| convertResult | back to summary |
|---|---|
| private Object convertResult(Object value) | |
| getParameterTypes | back to summary |
|---|---|
| public Class Implements com. Doc from com. Returns the types of the parameters to the callback method. | |
| getReturnType | back to summary |
|---|---|
| public Class Implements com. Doc from com. Returns the type of the callback method's return value. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Pointer | |
| public Object | invoke(Object
the proxy instance that the method was invoked on proxy, Method the method, Object[] Method instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or args)null if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer or java.lang.Boolean.Implements java. |
| function | back to summary |
|---|---|
| private Function function | |
| options | back to summary |
|---|---|
| private Map<K, V> options | |
| NativeFunctionHandler | back to summary |
|---|---|
| public NativeFunctionHandler(Pointer address, int callingConvention, Map<K, V> libOptions) | |
| getPointer | back to summary |
|---|---|
| public Pointer getPointer() | |
| invoke | back to summary |
|---|---|
| public Object invoke(Object proxy, Method method, Object[] args) throws Throwable Implements java. Chain invocation to the native function.
| |