[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Handling of null native values

alesj do-not-reply at jboss.com
Fri Nov 21 18:49:46 EST 2008


"scott.stark at jboss.org" wrote : This is implemented in the metavalue project now.
I think you are again doing it wrong, as with SimpleMetaValueComparator.
You should add this info to SimpleMetaType.

As you have all the info required in AbstractInstanceClassFactory::setValue.

  |    protected void setValue(BeanInfo beanInfo, PropertyInfo propertyInfo, Object object, Object unwrapValue)
  |       throws Throwable
  |    {
  |       TypeInfo type = propertyInfo.getType();
  |       if(unwrapValue == null && type.isPrimitive())
  |       {
  |          MetaType metaType = MetaTypeFactory.getInstance().resolve(type);
  |          SimpleMetaType smt = SimpleMetaType.class.cast(metaType);
  |          unwrapValue = smt.getDefaultValue(); // <-- missing method
  |       }
  |       propertyInfo.set(object, unwrapValue);
  |    }
  | 
More OO.


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

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



More information about the jboss-dev-forums mailing list