The attached patch allows users to easily define what I'm calling a "fluid" bean (though there might be a better name for it).
The idea here is to write a bean that doesn't follow the standard JavaBean convention. Specifically, a "fluid" bean's setters return "this," so you can "chain" calls to the setters, and the getters and setters don't start with "get/set" but are just the name of the property. For example:
Fluid beans have some limitations: you can't use indexed or mapped properties with a fluid bean (because there's no way to disambiguate an indexed getter from a simple setter). I think that's OK because indexed properties are a bit silly. (Why not just return a List or a Map?)
But I think they have substantial readability advantages. With a fluid bean, you can write code like this:
For an example of fluid chained setters in the wild, see (for example) Effective Java Second Edition by Joshua Bloch. In Item 2 "Consider a builder when faced with many constructor parameters" Bloch defines a fluid bean with chained setters, so you can use it like this:
|Fix Version/s||LATER THAN 1.8.1 [ 12312151 ]|
|Fix Version/s||2.0 [ 12325663 ]|
|Fix Version/s||LATER THAN 1.8.4 [ 12312151 ]|