Class ClosureManager

java.lang.Object
com.kenai.jffi.ClosureManager

public final class ClosureManager extends Object
Allocates and manages the lifecycle of native closures (aka callbacks)
  • Method Details

    • getInstance

      public static ClosureManager getInstance()
      Gets the global instance of the ClosureManager
      Returns:
      An instance of a ClosureManager
    • newClosure

      public final Closure.Handle newClosure(Closure closure, Type returnType, Type[] parameterTypes, CallingConvention convention)
      Wraps a java object that implements the Closure interface in a native closure.
      Parameters:
      closure - The java object to be called when the native closure is invoked.
      returnType - The return type of the closure.
      parameterTypes - The parameter types of the closure.
      convention - The calling convention of the closure.
      Returns:
      A new Closure.Handle instance.
    • newClosure

      public final Closure.Handle newClosure(Closure closure, CallContext callContext)
      Wraps a java object that implements the Closure interface in a native closure.
      Parameters:
      closure - The java object to be called when the native closure is invoked.
      callContext - The call context (return type, param types, convention) of the Closure
      Returns:
      A new Closure.Handle instance.
    • getClosurePool

      public final ClosurePool getClosurePool(CallContext callContext)
    • newClosureMagazine

      public ClosureMagazine newClosureMagazine(CallContext callContext, Method method)