org.apache.commons.beanutils

Class BeanPredicate

Implemented Interfaces:
Predicate

public class BeanPredicate
extends java.lang.Object
implements Predicate

Predicate implementation that applies the given Predicate to the result of calling the given property getter.

Field Summary

private Log
log
private Predicate
predicate
Predicate to be applied to the property value
private String
propertyName
Name of the property whose value will be predicated

Constructor Summary

BeanPredicate(String propertyName, Predicate predicate)
Constructs a BeanPredicate that applies the given Predicate to the named property value.

Method Summary

boolean
evaluate(Object object)
Evaluates the given object by applying the getPredicate() to a property value named by getPropertyName().
Predicate
getPredicate()
Gets the Predicate to be applied to the value of the named property during evaluate(Object).
String
getPropertyName()
Gets the name of the property whose value is to be predicated.
void
setPredicate(Predicate predicate)
Sets the Predicate to be applied to the value of the named property during evaluate(Object).
void
setPropertyName(String propertyName)
Sets the name of the property whose value is to be predicated.

Field Details

log

private final Log log

predicate

private Predicate predicate
Predicate to be applied to the property value

propertyName

private String propertyName
Name of the property whose value will be predicated

Constructor Details

BeanPredicate

public BeanPredicate(String propertyName,
                     Predicate predicate)
Constructs a BeanPredicate that applies the given Predicate to the named property value.
Parameters:
propertyName - the name of the property whose value is to be predicated, not null
predicate - the Predicate to be applied, not null

Method Details

evaluate

public boolean evaluate(Object object)
Parameters:
object - The object being evaluated
Returns:
the result of the predicate evaluation

getPredicate

public Predicate getPredicate()
Returns:
Predicate, not null

getPropertyName

public 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(Predicate predicate)
Parameters:
predicate - Predicate, not null

setPropertyName

public void setPropertyName(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

Copyright (c) 2001-2007 - Apache Software Foundation