/** * Binds a free variable of the given class to the this closure. * @param closedClass The type of the free variable to be bound to this closure * @return A proxy of the same class of the passed class used to register all the invocation on the closed object */ public <T> T of(Class<T> closedClass) { return of(closedClass, closedClass); }
/** * Defines the method invoked by this closure. * @param closedObject The object on which the closure has to be invoked. It can be a fixed object or a Class. * In this last case, if the method is not static, it is treated as it was an * unbound argument defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @param methodName The name of the method invoked by this closure or {@link AbstractClosure#CONSTRUCTOR} * if you want to call a constructor * @param args The arguments used to invoke this closure. They can be a mixed of fixed value and * unbound one defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @return The closure itself */ @Override public Closure2<A, B> of(Object closedObject, String methodName, Object ... args) { return (Closure2<A, B>)super.of(closedObject, methodName, args); } }
/** * Defines the method invoked by this closure. * @param closedObject The object on which the closure has to be invoked. It can be a fixed object or a Class. * In this last case, if the method is not static, it is treated as it was an * unbound argument defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @param methodName The name of the method invoked by this closure or {@link AbstractClosure#CONSTRUCTOR} * if you want to call a constructor * @param args The arguments used to invoke this closure. They can be a mixed of fixed value and * unbound one defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @return The closure itself */ @Override public Closure4<A, B, C, D> of(Object closedObject, String methodName, Object ... args) { return (Closure4<A, B, C, D>)super.of(closedObject, methodName, args); } }
/** * Defines the method invoked by this closure. * @param closedObject The object on which the closure has to be invoked. It can be a fixed object or a Class. * In this last case, if the method is not static, it is treated as it was an * unbound argument defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @param methodName The name of the method invoked by this closure or {@link AbstractClosure#CONSTRUCTOR} * if you want to call a constructor * @param args The arguments used to invoke this closure. They can be a mixed of fixed value and * unbound one defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @return The closure itself */ @Override public Closure of(Object closedObject, String methodName, Object ... args) { return (Closure)super.of(closedObject, methodName, args); } }
/** * Defines the method invoked by this closure. * @param closedObject The object on which the closure has to be invoked. It can be a fixed object or a Class. * In this last case, if the method is not static, it is treated as it was an * unbound argument defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @param methodName The name of the method invoked by this closure or {@link AbstractClosure#CONSTRUCTOR} * if you want to call a constructor * @param args The arguments used to invoke this closure. They can be a mixed of fixed value and * unbound one defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @return The closure itself */ @Override public Closure1<A> of(Object closedObject, String methodName, Object ... args) { return (Closure1<A>)super.of(closedObject, methodName, args); } }
/** * Defines the method invoked by this closure. * @param closedObject The object on which the closure has to be invoked. It can be a fixed object or a Class. * In this last case, if the method is not static, it is treated as it was an * unbound argument defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @param methodName The name of the method invoked by this closure or {@link AbstractClosure#CONSTRUCTOR} * if you want to call a constructor * @param args The arguments used to invoke this closure. They can be a mixed of fixed value and * unbound one defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @return The closure itself */ @Override public Closure0 of(Object closedObject, String methodName, Object ... args) { return (Closure0)super.of(closedObject, methodName, args); } }
/** * Defines the method invoked by this closure. * @param closedObject The object on which the closure has to be invoked. It can be a fixed object or a Class. * In this last case, if the method is not static, it is treated as it was an * unbound argument defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @param methodName The name of the method invoked by this closure or {@link AbstractClosure#CONSTRUCTOR} * if you want to call a constructor * @param args The arguments used to invoke this closure. They can be a mixed of fixed value and * unbound one defined through the {@link ch.lambdaj.Lambda#var(Class)} method * @return The closure itself */ @Override public Closure3<A, B, C> of(Object closedObject, String methodName, Object ... args) { return (Closure3<A, B, C>)super.of(closedObject, methodName, args); } }
/** * Binds an object to this closure. * @param closed The object that has to be bound to this closure * @return A proxy of the same class of the passed object used to register all the invocation on the closed object */ public <T> T of(T closed) { return of(closed, (Class<T>)closed.getClass()); }
/** * Binds an object to the active closure that is the last one created in the current thread. * @param closed The object that has to be bind to the active closure * @param closedClass The actual class of the proxied object * @return An instance of the closedClass that is actually a proxy used to register all the invocation on the closed object */ public static <T> T bindClosure(Object closed, Class<T> closedClass) { return CLOSURES.get().of(closed, closedClass); }