Doing this I wrote a very useful ContentUtil.setProperties(bean, node) which sets properties based on a node's data. This is very useful for configurations.

Sounds interesting - maybe post the link to svn the next time so that we end users can easily check what you talk about ;-)

Can't... else you would see that this method contains only one line of code ;-D

The method is more useful for core developers than for end users. There are many places in the code where we read a node, get some nodedata values from it and finally set it on a bean (well, we should do this more often ...). This convenience method does exactly the same. It checks if a property exists on the bean using the same name as any nodedata on the node. If so, the value get's set (if it has the same type).

Why is this important: there are places where the code can't know which kind of properties a concrete implementation class will have (a command or a dialog control would be a nice example) and you don't like to put knowledge about the repository into that bean (because you like to create a dialog control without having a corresponding node). At this point you must use reflection (better annotations in java 5.0) to initialize this bean.

Remark: this is not thought to be any kind of persistence system

Why should we use properties more often? In the current dialog controls you never know exactly which kind of parameters you can use to configure it. You always need to have a look at the source code first. But if we would use properties instead, everyone could notice in the javadoc, that this control takes a specific property (label, defaultValue, backgroudColor, ...).

For those who are still reading:

http://svn.magnolia.info/view/magnolia/trunk/magnolia-core/src/main/ java/info/magnolia/cms/util/ContentUtil.java

Regards,

Philipp Bracher
obinary ltd.

-----------------------------------------------------
[EMAIL PROTECTED]       http://obinary.com
magnolia content management      http://magnolia.info
-----------------------------------------------------





----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to