Java BeanUtils Querying Or Filtering Collections Java Bean Utils

What is Java BeanUtils Querying Or Filtering Collections?


The collections of beans can be filtered in the commons-collections by using the interface Predicate and also presents both true or false value at the evaluation of an enter object. there is a Predicate called BeanPropertyValueEqualsPredicate which will assess the set property value against the given value.


The above syntax has two parameters, which decides what property to be evaluated and what should be its expected value. It creates a Predicate for comparing the target object and returns true if the value specific by propertyName is equal to the value unique by the propertyValue; otherwise it returns false.

The property names are defined by org.apache.commons.beanutils.PropertyUtils and can be simple, indexed, nested or mapped.
For example, you may filter a collection of beans where myCar property is false:

The above code filters the 'myCollection' collection and returns the boolean value for the object's myCar property.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Java Bean Utils Topics