use of com.orientechnologies.orient.core.exception.OSchemaException in project orientdb by orientechnologies.
the class OObjectSerializerHelper method setFieldValue.
public static void setFieldValue(final Object iPojo, final String iProperty, final Object iValue) {
final Class<?> c = iPojo.getClass();
final String className = c.getName();
getClassFields(c);
try {
Object o = setters.get(className + "." + iProperty);
if (o instanceof Method) {
((Method) o).invoke(iPojo, OObjectSerializerHelper.convertInObject(iPojo, iProperty, iValue, ((Method) o).getParameterTypes()[0]));
} else if (o instanceof Field) {
((Field) o).set(iPojo, OType.convert(iValue, ((Field) o).getType()));
}
} catch (Exception e) {
throw OException.wrapException(new OSchemaException("Cannot set the value '" + iValue + "' to the property '" + iProperty + "' for the pojo: " + iPojo), e);
}
}
Aggregations