((SelfAttributeApplicator)instance).applyAttributes(attributes);
} else {
MetaClass mc = ofi.getMetaClassForNode(nodeName);
if (mc.getTheClass() != instance.getClass()) mc = InvokerHelper.getMetaClass(instance.getClass());
for (Object key : attributes.keySet()) {
MetaProperty prop = mc.getMetaProperty(String.valueOf(key));
if (prop == null) {
try {
Field field = mc.getTheClass().getField(String.valueOf(key));
field.set(instance, attributes.get(key));
}
catch (SecurityException e) {}
catch (NoSuchFieldException e) {}
catch (IllegalAccessException e) {}
throw new RuntimeException("Could not find " + key + " property/attribute on " + instance);
} else {
prop.setProperty(instance, attributes.get(key));
}
}
}
}