Hi devs,
Currently we are using BeanUtils to convert and populate macros
parameters and configuration. Problem is that BeanUtil has some
limitations:
- beanutils can't be configured to ignore case which is a pain for
macro parameters
- beanutils does not support enum or even base class so each enum
converter has to be registered one by one
- beanutils does not support public fields has bean properties
- beanutils not not support any annotation based validation
- we already have severall places in different components which use
beauntil to load java bean and they can't share custom converters not
provided by beauntil, a unique component will permit to add a bunch of
converters when initializing it
I propose to create our own component and api to deal with it.
You can find a first proto on
http://jira.xwiki.org/jira/browse/XWIKI-3171:
* the entry point is PropertiesManager: it provide a populate
method and cached beans descriptors
* the populate method ignore case
* the populate method validate the bean using JSR 303 (use
hibernate-validator 4beta1 implementation)
* if the bean implements RowProperties, the remaining property
(the one non populated using setters of public fields) are given to it
as custom properties
* the populate method conversion use ConvertUtils so any
registered Converter against ConvertUtils is supported
* the populate method conversion also add support for:
o any Enum conversion, no need to register each enum anymore
o it also add support for Color conversion using "r,g,b" or
"#xxxxxx" format
* the populate method and the bean descriptor support public fields
I would like to commit it in 1.9 or 2.0 branch (I would prefer 1.9
branch at least for the ignore case part and since it change some api
used by macros it's better to commit it as soon as possible).
Here is my +1
--
Thomas Mortagne