GREYCollection of proposed additions or improvements to Content2BeanGREY
There are already a couple of issues opened for Content2Bean (see below)
Here's just a collection of possible further ideas or improvements:
There are a great deal of things we could do with annotations to "drive" content2bean.
It is cumbersome to add
setEnabled methods in all beans converted by c2b. It's even more cumbersome to check for those in the code using those beans. Here's a proposal to add
@NullIfDisabled: if a bean has this annotation, and the corresponding has an unused property (not associated to a bean property) named "enabled" and set to "false", or "disabled" and set to "true", the bean is nulled and not added to collections.
@CommaSeparated - or support for multi-valued properties
Often times, a bean needs to be configured with a List<String> or String. And in most of these cases, it's cumbersome to create sub-nodes for this list. If we don't support multi-valued properties in the tree (and in c2b!), perhaps an annotation on the bean itself could be introduced, indicating that the one string value should be converted by c2b to an array of strings. Example use-case:
Some components are not useable, and should not be used, if not configured properly. Similar to
@NullIfDisabled we could perhaps introduce an interface with a method such as
isReady() which would validate the configuration's completeness ? (possibly throwing an exception or return a message of some sort)