Exemplo n.º 1
0
 /**
  * Creates a Closure that will invoke a specific method on the closure's input object by
  * reflection.
  *
  * @see org.apache.commons.collections4.functors.InvokerTransformer
  * @see org.apache.commons.collections4.functors.TransformerClosure
  * @param <E> the type that the closure acts on
  * @param methodName the name of the method
  * @param paramTypes the parameter types
  * @param args the arguments
  * @return the <code>invoker</code> closure
  * @throws IllegalArgumentException if the method name is null
  * @throws IllegalArgumentException if the paramTypes and args don't match
  */
 public static <E> Closure<E> invokerClosure(
     final String methodName, final Class<?>[] paramTypes, final Object[] args) {
   // reuse transformer as it has caching - this is lazy really, should have inner class here
   return asClosure(
       InvokerTransformer.<E, Object>invokerTransformer(methodName, paramTypes, args));
 }
Exemplo n.º 2
0
 /**
  * Creates a Closure that will invoke a specific method on the closure's input object by
  * reflection.
  *
  * @see org.apache.commons.collections4.functors.InvokerTransformer
  * @see org.apache.commons.collections4.functors.TransformerClosure
  * @param <E> the type that the closure acts on
  * @param methodName the name of the method
  * @return the <code>invoker</code> closure
  * @throws IllegalArgumentException if the method name is null
  */
 public static <E> Closure<E> invokerClosure(final String methodName) {
   // reuse transformer as it has caching - this is lazy really, should have inner class here
   return asClosure(InvokerTransformer.<E, Object>invokerTransformer(methodName));
 }