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.
Java Bean Utils Related Interview Questions
|Adv Java Interview Questions||J2EE Interview Questions|
|Core Java Interview Questions||JSP Interview Questions|
|Java-Springs Interview Questions||JMS(Java Message Service) Interview Questions|
|Java applet Interview Questions||Java Interview Questions|
|Remote Method Invocation Interview Questions||JavaMail API Interview Questions|
|Java 8 Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Java Programmer Interview Questions|
Java Bean Utils Tutorial
Java Bean Utils
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.