[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Nested property ref

adrian@jboss.org do-not-reply at jboss.com
Fri Nov 16 06:16:34 EST 2007


"alesj" wrote : Extending Trustin's user question to dev forum:
  |  - http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105341
  | 
  | Supporting 2nd example is trivial, just a simple recursion on the property lookup in AbstractDependencyValueMetaData.
  | 
  | I guess we could support the 1st one in a similar way as we did value-factory.
  | Perhaps we can even extend existing value-factory notion to do that?

You can support both very easily. The "." cannot be part of java property name,
so would be legal to include in property names for both examples without
breaking existing configurations.

The first one looks a bit hacky to me. You only recurse until the second to last
property using getters to locate the object then use the setter for the last property.

The other part is that you have to take into null return from the getters (an error)
and the BeanInfo for the object retrieved from the getter has to be retrieved
at each step.

The first example can actually be done already with a factory configuration.


  | <bean name="TopLevel" .../>
  | 
  | <bean name="Configuration" ...>
  |    <constructor><factory bean="TopLevel' method="getConfiguration"/></constructor>
  |    <property name="nested">sdfkjsdf</property>
  | </bean>
  | 

But that's a bit long winded compared to. ;-)

  | <bean name="TopLevel" ...>
  |    <property name="configuration.nested">sdfkjsdf</property>
  | </bean>
  | 

P.S. You should also add the first example to the plain javabean xml.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105418#4105418

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105418



More information about the jboss-dev-forums mailing list