/** * Creates a Predicate that invokes a method on the input object. * The method must return either a boolean 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, Class[] 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 Predicate that invokes a method on the input object. * The method must return either a boolean 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 boolean 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 boolean 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, Class[] 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)); }
public void testAsPredicateTransformerEx1() { try { PredicateUtils.asPredicate(null); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testAsPredicateTransformerEx2() { try { PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(null); } catch (FunctorException ex) { return; } fail(); }
public void testAsPredicateTransformer() { assertEquals(false, PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.FALSE)); assertEquals(true, PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.TRUE)); }
/** * Creates a Predicate that invokes a method on the input object. * The method must return either a boolean 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, Class[] 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 Predicate that invokes a method on the input object. * The method must return either a boolean 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 boolean 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 boolean 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 boolean 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, Class[] 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 Predicate that invokes a method on the input object. * The method must return either a boolean 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 boolean 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 boolean 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, Class[] 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 Predicate that invokes a method on the input object. * The method must return either a boolean 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, Class[] 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 Predicate that invokes a method on the input object. * The method must return either a boolean 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, Class[] 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)); }