CallbackReference (JNA API)

Overview | Package | Class | Tree | Deprecated | Index | Help
| JNA API 3.3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jna
Class CallbackReference

    java.lang.Object
      java.lang.ref.Reference<T>
          java.lang.ref.WeakReference
              com.sun.jna.CallbackReference

     class CallbackReference

extends WeakReference

Provides a reference to an association between a native callback closure and a Java `Callback` closure.

Field Summary
`(package private) static Map` | `allocations`
`(package private) static Map` | `callbackMap`
`(package private) Pointer` | `cbstruct`
`(package private) static Map` | `directCallbackMap`
`(package private) Method` | `method`
`(package private) CallbackProxy` | `proxy`

Method Summary
`protected void` | `dispose()` Free native resources associated with this callback.
`protected void` | `finalize()` Free native resources associated with this callback when GC'd.
`(package private) static Class` | `findCallbackClass(Class type)` Find the first instance of an interface which implements the Callback interface or an interface derived from Callback, which defines an appropriate callback method.
`static Callback` | `getCallback(Class type, Pointer p)` Return a Callback associated with the given function pointer.
`static Pointer` | `getFunctionPointer(Callback cb)` Return a `Pointer` to the native function address for the given callback.
`Pointer` | `getTrampoline()` Obtain a pointer to the native glue code for this callback.

Methods inherited from class java.lang.ref.Reference
`clear, enqueue, get, isEnqueued`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### callbackMap

    static final Map callbackMap

### directCallbackMap

    static final Map directCallbackMap

### allocations

    static final Map allocations

### cbstruct

    Pointer cbstruct

### proxy

    CallbackProxy proxy

### method

    Method method

Method Detail

### getCallback

    public static Callback getCallback(Class 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.

### findCallbackClass

    static Class findCallbackClass(Class type)

  Find the first instance of an interface which implements the Callback interface or an interface derived from Callback, which defines an appropriate callback method.

### getTrampoline

    public Pointer getTrampoline()

  Obtain a pointer to the native glue code for this callback.

### finalize

    protected void finalize()

  Free native resources associated with this callback when GC'd.

  Overrides:
    `finalize` in class `Object`

### dispose

    protected void dispose()

  Free native resources associated with this callback.

### getFunctionPointer

    public static Pointer getFunctionPointer(Callback cb)

  Return a `Pointer` to the native function address for the given callback.

Overview | Package | Class | Tree | Deprecated | Index | Help
| JNA API 3.3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007-2010 Timothy Wall. All Rights Reserved.