Package org.apache.commons.beanutils2
Class BeanPredicate<T>
java.lang.Object
org.apache.commons.beanutils2.BeanPredicate<T>
- Type Parameters:
T
- the type of the input to the predicate
- All Implemented Interfaces:
Predicate<T>
Predicate implementation that applies the given Predicate
to the result of calling the given property getter.
-
Constructor Summary
ConstructorDescriptionBeanPredicate
(String propertyName, Predicate<T> predicate) Constructs aBeanPredicate
that applies the givenPredicate
to the named property value. -
Method Summary
Modifier and TypeMethodDescriptionGets thePredicate
to be applied to the value of the named property duringtest(Object)
.Gets the name of the property whose value is to be predicated. in the evaluation.void
setPredicate
(Predicate<T> predicate) Sets thePredicate
to be applied to the value of the named property duringtest(Object)
.void
setPropertyName
(String propertyName) Sets the name of the property whose value is to be predicated.boolean
Evaluates the given object by applying thegetPredicate()
to a property value named bygetPropertyName()
.
-
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
-
getPredicate
Gets thePredicate
to be applied to the value of the named property duringtest(Object)
.- Returns:
Predicate
, not null
-
getPropertyName
Gets the name of the property whose value is to be predicated. in the evaluation.- Returns:
- the property name, not null
-
setPredicate
Sets thePredicate
to be applied to the value of the named property duringtest(Object)
.- Parameters:
predicate
-Predicate
, 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
-
test
Evaluates the given object by applying thegetPredicate()
to a property value named bygetPropertyName()
.- Specified by:
test
in interfacePredicate<T>
- Parameters:
object
- The object to test- Returns:
- the result of the predicate evaluation
- Throws:
IllegalArgumentException
- when the property cannot be evaluated
-