/// <summary> /// In addition, you can use native System.Type param... /// </summary> /// <param name="methodName"></param> /// <param name="paramTypes"></param> /// <param name="args"></param> /// <returns></returns> public static Transformer invokerTransformer(String methodName, System.Type[] paramTypes, Object[] args) { return(InvokerTransformer.getInstance(methodName, paramTypes, args)); }
/** * Gets a Transformer that invokes a method on the input object. * The method must have no parameters. If the input object is null, * null is returned. * <p> * For example, <code>TransformerUtils.invokerTransformer("getName");</code> * will call the <code>getName/code> method on the input object to * determine the transformer result. * * @see org.apache.commons.collections.functors.InvokerTransformer * * @param methodName the method name to call on the input object, may not be null * @return the transformer * @throws IllegalArgumentException if the methodName is null. */ public static Transformer invokerTransformer(String methodName) { return(InvokerTransformer.getInstance(methodName, (java.lang.Class[])null, null)); }
/** * Creates a Predicate that invokes a method on the input object. * The method must return either a bool or a non-null Boolean, * and have no parameters. If the input object is null, a * PredicateException is thrown. * <p> * For example, <code>PredicateUtils.invokerPredicate("isEmpty");</code> * will call the <code>isEmpty</code> method on the input object to * determine the predicate result. * * @see org.apache.commons.collections.functors.InvokerTransformer * @see org.apache.commons.collections.functors.TransformerPredicate * * @param methodName the method name to call on the input object, may not be null * @return the predicate * @throws IllegalArgumentException if the methodName is null. */ public static Predicate invokerPredicate(String methodName) { // reuse transformer as it has caching - this is lazy really, should have inner class here return(asPredicate(InvokerTransformer.getInstance(methodName))); }
/** * Creates a Predicate that invokes a method on the input object. * The method must return either a bool or a non-null Boolean, * and have no parameters. If the input object is null, a * PredicateException is thrown. * <p> * For example, <code>PredicateUtils.invokerPredicate("isEmpty");</code> * will call the <code>isEmpty</code> method on the input object to * determine the predicate result. * * @see org.apache.commons.collections.functors.InvokerTransformer * @see org.apache.commons.collections.functors.TransformerPredicate * * @param methodName the method name to call on the input object, may not be null * @param paramTypes the parameter types * @param args the arguments * @return the predicate * @throws IllegalArgumentException if the method name is null * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Predicate invokerPredicate(String methodName, Type[] paramTypes, Object[] args) { // reuse transformer as it has caching - this is lazy really, should have inner class here return(asPredicate(InvokerTransformer.getInstance(methodName, paramTypes, args))); }
/** * Creates a Closure that will invoke a specific method on the closure's * input object by reflection. * * @see org.apache.commons.collections.functors.InvokerTransformer * @see org.apache.commons.collections.functors.TransformerClosure * * @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 Closure invokerClosure(String methodName, java.lang.Class[] paramTypes, Object[] args) { // reuse transformer as it has caching - this is lazy really, should have inner class here return(asClosure(InvokerTransformer.getInstance(methodName, paramTypes, args))); }