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 Object implements org.apache.commons.collections.Predicate

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BeanPredicate(String propertyName, org.apache.commons.collections.Predicate predicate)`
  Constructs a `BeanPredicate` that applies the given `Predicate` to the named property value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `evaluate(Object object)`
  Evaluates the given object by applying the `getPredicate()` to a property value named by `getPropertyName()`.
  `org.apache.commons.collections.Predicate`
  `getPredicate()`
  Gets the `Predicate` to be applied to the value of the named property during `evaluate(java.lang.Object)`.
  `String`
  `getPropertyName()`
  Gets the name of the property whose value is to be predicated.
  `void`
  `setPredicate(org.apache.commons.collections.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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BeanPredicate

    public BeanPredicate(String propertyName, org.apache.commons.collections.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)
    Evaluates the given object by applying the `getPredicate()` to a property value named by `getPropertyName()`.
    Specified by:
      `evaluate` in interface `org.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

  - ### getPredicate

    public org.apache.commons.collections.Predicate getPredicate()
    Gets the `Predicate` to be applied to the value of the named property during `evaluate(java.lang.Object)`.
    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(org.apache.commons.collections.Predicate predicate)
    Sets the `Predicate` to be applied to the value of the named property during `evaluate(Object)`.
    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