Package com.kenai.jffi
Class ClosureManager
java.lang.Object
com.kenai.jffi.ClosureManager
public final class ClosureManager
extends java.lang.Object
Allocates and manages the lifecycle of native closures (aka callbacks)
-
Method Summary
Modifier and Type Method Description ClosurePoolgetClosurePool(CallContext callContext)static ClosureManagergetInstance()Gets the global instance of theClosureManagerClosure.HandlenewClosure(Closure closure, CallContext callContext)Wraps a java object that implements theClosureinterface in a native closure.Closure.HandlenewClosure(Closure closure, Type returnType, Type[] parameterTypes, CallingConvention convention)Wraps a java object that implements theClosureinterface in a native closure.ClosureMagazinenewClosureMagazine(CallContext callContext, java.lang.reflect.Method method)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
getInstance
Gets the global instance of theClosureManager- 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 theClosureinterface 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.Handleinstance.
-
newClosure
Wraps a java object that implements theClosureinterface 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.Handleinstance.
-
getClosurePool
-
newClosureMagazine
public ClosureMagazine newClosureMagazine(CallContext callContext, java.lang.reflect.Method method)
-