Java BeanUtils Tutorial
Standard JavaBeans
Dynamic Beans (DynaBeans)
Data Type Conversions
Utility Objects & Classes
Collections
Java BeanUtils Useful Resources
Selected Reading
Standard JavaBeans
- Suppressing Properties
- Customizing Introspection
- Nested Property Access
- Basic Property Access
- Background
Dynamic Beans (DynaBeans)
Data Type Conversions
Utility Objects & Classes
Collections
Java BeanUtils Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Transforming Collections
Java BeanUtils - Transforming Collections
Description
The conversion from input object to output object is supported in commons-collections with the help of Transformer interface. The Transformers can be appped to get the output collection from input collection with the help of codes available in Commons-collections. BeanToPropertyTransformer is an example of Transformer that will convert a bean to its property value. This feature is able to extract a particular property from the input object and present it as output object.
If you try to find out a particular car model from many car users in a collection. The syntax is shown below:
// creating transformer BeanToPropertyValueTransformer transformer = new BeanToPropertyValueTransformer( "person.company.carmodel" ); // transforming Collection Collection carModel = CollectionUtils.collect( peopleCollection, transformer );Advertisements