updated: Jun 17 2008
*You can tell a lot about a fellow's character by his way of eating jellybeans. (Ronald Reagan)
Sorry, documentation is not yet complete and does not provide sufficient information. Please refer to test cases, javadoc and sources for more details.
If you need more info on this particular subject, do not hesitate to demand more documentation.
Bean utilities allow setting and reading bean properties, as most other similar libraries. However, we think that several things make it different. First, it is the fastest bean manipulation utility. Second, it works with attributes and properties in the same time: when class doesn't define setters and getters, its attributes will be used. Third, there is a nice variety of available functions that might suit most needs. Code is divided in logical sections, so it is easy to use it in specific way, if there is such requirements.
BeanUtil works with simple, indexed and nested properties, as well as with their combinations. It is aware of arrays, lists and maps.
BeanUtil.getProperty(dest, "fooFloat"); BeanUtil.getDeclaredProperty(cbean, "list.map[foo].fooProp"); // reads non-public properties BeanUtil.setProperty(cbean, "foo", aFooValue);
Setting properties can be done in several ways. By default, setting non-existing property will throw an unchecked exception. Silent setting doesn't throw exception, but returns boolean result about the success of the operation.
Interesting is forced setting. When this type is used, then all
BeanUtil.setPropertyForced(x, "y.foo", value); BeanUtil.setPropertyForced(x, "yy.foo", "xxx");
BeanUtil comes in different flavors: silent (no exception is thrown), forced (creates missing properties), declared (includes non-public properties)...