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>`

public class BeanPredicate<T> extends Object implements Predicate<T>

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BeanPredicate(String propertyName, Predicate<T> predicate)`
  Constructs a `BeanPredicate` that applies the given `Predicate` to the named property value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Predicate<T>`
  `getPredicate()`
  Gets the `Predicate` to be applied to the value of the named property during `test(Object)`.
  `String`
  `getPropertyName()`
  Gets the name of the property whose value is to be predicated. in the evaluation.
  `void`
  `setPredicate(Predicate<T> predicate)`
  Sets the `Predicate` to be applied to the value of the named property during `test(Object)`.
  `void`
  `setPropertyName(String propertyName)`
  Sets the name of the property whose value is to be predicated.
  `boolean`
  `test(Object object)`
  Evaluates the given object by applying the `getPredicate()` to a property value named by `getPropertyName()`.

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

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

  ### Methods inherited from interface java.util.function.Predicate

  `and, negate, or`

- ## Constructor Details

  - ### BeanPredicate

    public BeanPredicate(String propertyName, Predicate<T> 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

  - ### getPredicate

    public Predicate<T> getPredicate()
    Gets the `Predicate` to be applied to the value of the named property during `test(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(Predicate<T> predicate)
    Sets the `Predicate` to be applied to the value of the named property during `test(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

  - ### test

    public boolean test(Object object)
    Evaluates the given object by applying the `getPredicate()` to a property value named by `getPropertyName()`.
    Specified by:
      `test` in interface `Predicate<T>`
    Parameters:
      `object` - The object to test
    Returns:
      the result of the predicate evaluation
    Throws:
      `IllegalArgumentException` - when the property cannot be evaluated