Class CallbackHandler

java.lang.Object
ch.bailu.gtk.lib.handler.CallbackHandler

public class CallbackHandler extends Object
Handler to callback resource. Stores java reference to callback in a hash map Provides function to free reference to callback
  • Constructor Summary

    Constructors
    Constructor
    Description
    CallbackHandler(Pointer instance, String methodName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Dump resources (contents of internal map as text) to stream
    Get instance this callback ist registered to Only call this if this callbacks will never called again
    Name of method this callback was registered with
    void
    register(com.sun.jna.Callback callback)
    For internal use (gets called after callback was passed to a C function)
     
    void
    Unregister this callback Removes java reference to callback Only call this if this callbacks will never called again
    static void
    unregister(Pointer instance)
    Unregister all callbacks of this instance Removes java reference to callback Only call this if this callbacks will never called again
    static void
    unregister(Pointer instance, String methodName)
     
    void
    unregister(String methodName)
    Unregister this callback if its methodName equals methodName Removes java reference to callback Only call this if this callbacks will never called again

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CallbackHandler

      public CallbackHandler(Pointer instance, String methodName)
  • Method Details

    • register

      public void register(com.sun.jna.Callback callback)
      For internal use (gets called after callback was passed to a C function)
      Parameters:
      callback - (lambda)
    • unregister

      public void unregister()
      Unregister this callback Removes java reference to callback Only call this if this callbacks will never called again
    • unregister

      public static void unregister(Pointer instance)
      Unregister all callbacks of this instance Removes java reference to callback Only call this if this callbacks will never called again
      Parameters:
      instance -
    • unregister

      public void unregister(String methodName)
      Unregister this callback if its methodName equals methodName Removes java reference to callback Only call this if this callbacks will never called again
      Parameters:
      methodName - string identifier (name)
    • unregister

      public static void unregister(Pointer instance, String methodName)
    • getInstance

      public Pointer getInstance()
      Get instance this callback ist registered to Only call this if this callbacks will never called again
      Returns:
      instance this callback belongs to
    • getMethodName

      public String getMethodName()
      Name of method this callback was registered with
      Returns:
      methodName
    • dump

      public static void dump(PrintStream out)
      Dump resources (contents of internal map as text) to stream
      Parameters:
      out - stream
    • toString

      public String toString()
      Overrides:
      toString in class Object