Package org.apache.commons.beanutils
Class BeanPredicate
- java.lang.Object
-
- org.apache.commons.beanutils.BeanPredicate
-
- All Implemented Interfaces:
org.apache.commons.collections.Predicate
public class BeanPredicate extends java.lang.Object implements org.apache.commons.collections.PredicatePredicate implementation that applies the given
Predicateto the result of calling the given property getter.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.commons.logging.Loglogprivate org.apache.commons.collections.PredicatepredicatePredicateto be applied to the property valueprivate java.lang.StringpropertyNameName of the property whose value will be predicated
-
Constructor Summary
Constructors Constructor Description BeanPredicate(java.lang.String propertyName, org.apache.commons.collections.Predicate predicate)Constructs aBeanPredicatethat applies the givenPredicateto the named property value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanevaluate(java.lang.Object object)Evaluates the given object by applying thegetPredicate()to a property value named bygetPropertyName().org.apache.commons.collections.PredicategetPredicate()Gets thePredicateto be applied to the value of the named property duringevaluate(java.lang.Object).java.lang.StringgetPropertyName()Gets the name of the property whose value is to be predicated.voidsetPredicate(org.apache.commons.collections.Predicate predicate)Sets thePredicateto be applied to the value of the named property duringevaluate(Object).voidsetPropertyName(java.lang.String propertyName)Sets the name of the property whose value is to be predicated.
-
-
-
Constructor Detail
-
BeanPredicate
public BeanPredicate(java.lang.String propertyName, org.apache.commons.collections.Predicate predicate)Constructs aBeanPredicatethat applies the givenPredicateto the named property value.- Parameters:
propertyName- the name of the property whose value is to be predicated, not nullpredicate- thePredicateto be applied, not null
-
-
Method Detail
-
evaluate
public boolean evaluate(java.lang.Object object)
Evaluates the given object by applying thegetPredicate()to a property value named bygetPropertyName().- Specified by:
evaluatein interfaceorg.apache.commons.collections.Predicate- Parameters:
object- The object being evaluated- Returns:
- the result of the predicate evaluation
- Throws:
java.lang.IllegalArgumentException- when the property cannot be evaluated
-
getPredicate
public org.apache.commons.collections.Predicate getPredicate()
Gets thePredicateto be applied to the value of the named property duringevaluate(java.lang.Object).- Returns:
Predicate, not null
-
getPropertyName
public java.lang.String getPropertyName()
Gets the name of the property whose value is to be predicated. in the evaluation.- Returns:
- the property name, not null
-
setPredicate
public void setPredicate(org.apache.commons.collections.Predicate predicate)
Sets thePredicateto be applied to the value of the named property duringevaluate(Object).- Parameters:
predicate-Predicate, not null
-
setPropertyName
public void setPropertyName(java.lang.String propertyName)
Sets the name of the property whose value is to be predicated.- Parameters:
propertyName- the name of the property whose value is to be predicated, not null
-
-