Package org.apache.commons.beanutils
Class BeanPredicate
java.lang.Object
org.apache.commons.beanutils.BeanPredicate
- All Implemented Interfaces:
org.apache.commons.collections.Predicate
Predicate implementation that applies the given Predicate
to the result of calling the given property getter.
- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.commons.logging.Log
private org.apache.commons.collections.Predicate
Predicate
to be applied to the property valueprivate String
Name of the property whose value will be predicated -
Constructor Summary
ConstructorsConstructorDescriptionBeanPredicate
(String propertyName, org.apache.commons.collections.Predicate predicate) Constructs aBeanPredicate
that applies the givenPredicate
to the named property value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Evaluates the given object by applying thegetPredicate()
to a property value named bygetPropertyName()
.org.apache.commons.collections.Predicate
Gets thePredicate
to be applied to the value of the named property duringevaluate(java.lang.Object)
.Gets the name of the property whose value is to be predicated.void
setPredicate
(org.apache.commons.collections.Predicate predicate) Sets thePredicate
to be applied to the value of the named property duringevaluate(Object)
.void
setPropertyName
(String propertyName) Sets the name of the property whose value is to be predicated.
-
Field Details
-
log
private final org.apache.commons.logging.Log log -
propertyName
Name of the property whose value will be predicated -
predicate
private org.apache.commons.collections.Predicate predicatePredicate
to be applied to the property value
-
-
Constructor Details
-
BeanPredicate
Constructs aBeanPredicate
that applies the givenPredicate
to the named property value.- Parameters:
propertyName
- the name of the property whose value is to be predicated, not nullpredicate
- thePredicate
to be applied, not null
-
-
Method Details
-
evaluate
Evaluates the given object by applying thegetPredicate()
to a property value named bygetPropertyName()
.- Specified by:
evaluate
in interfaceorg.apache.commons.collections.Predicate
- Parameters:
object
- The object being evaluated- Returns:
- the result of the predicate evaluation
- Throws:
IllegalArgumentException
- when the property cannot be evaluated
-
getPropertyName
Gets the name of the property whose value is to be predicated. in the evaluation.- Returns:
- the property name, not null
-
setPropertyName
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
-
getPredicate
public org.apache.commons.collections.Predicate getPredicate()Gets thePredicate
to be applied to the value of the named property duringevaluate(java.lang.Object)
.- Returns:
Predicate
, not null
-
setPredicate
public void setPredicate(org.apache.commons.collections.Predicate predicate) Sets thePredicate
to be applied to the value of the named property duringevaluate(Object)
.- Parameters:
predicate
-Predicate
, not null
-