示例#1
0
 public Object getValue(String name) {
   PropertyTokenizer prop = new PropertyTokenizer(name);
   if (prop.hasNext()) {
     MetaObject metaValue = metaObjectForProperty(prop.getIndexedName());
     if (metaValue == MetaObjectUtils.NULL_META_OBJECT) {
       return null;
     } else {
       return metaValue.getValue(prop.getChildren());
     }
   } else {
     return objectWrapper.get(prop);
   }
 }
示例#2
0
 public void setValue(String name, Object value) {
   PropertyTokenizer prop = new PropertyTokenizer(name);
   if (prop.hasNext()) {
     MetaObject metaValue = metaObjectForProperty(prop.getIndexedName());
     if (metaValue == MetaObjectUtils.NULL_META_OBJECT) {
       if (value == null && prop.getChildren() != null) {
         return; // don't instantiate child path if value is null
       } else {
         metaValue = objectWrapper.instantiatePropertyValue(name, prop, objectFactory);
       }
     }
     metaValue.setValue(prop.getChildren(), value);
   } else {
     objectWrapper.set(prop, value);
   }
 }