[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Field injection

adrian@jboss.org do-not-reply at jboss.com
Fri Mar 14 08:42:29 EDT 2008


"alesj" wrote : A first hurdle.
  | 
  | How to get past this usage in PropertyDispatchWrapper (kernel module):
  | 
  |   |          PropertyInfo propertyInfo = BeanInfoUtil.getPropertyInfo(beanInfo, target, name);
  |   |          ValueMetaData valueMetaData = property.getValue();
  |   |          Object value = valueMetaData.getValue(propertyInfo.getType(), cl);
  |   |          beanInfo.setProperty(target, name, value);
  |   | 
  | Since I need the expected type of the value in order to convert it to the right type, e.g. string --> Date.
  | 
  | But what if my bean is in FIELD or ALL mode, and there is no such property?
  | 
  | Anything that comes to my mind in api extension to get the type by name from BeanInfo feels wrong. :-)

I don't understand. 
So either you don't undetrstand or you haven't explained it very well. ;-)

You can't set a property unless it exists in the BeanInfo


  | public class MyClass
  | {
  |    private Date myDate;
  | }
  | 

This should have a BeanInfo with one property which is a FieldPropertyInfo
i.e. instead of:
MethodInfo getter, setter;
it has
FieldInfo field; (there is no getter/setter)

propertyInfo.getType() -> field.getType(); // instead of the "return type"
propertyInfo.set() -> field.set(); // instead of a method invocation

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

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



More information about the jboss-dev-forums mailing list