public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); if (setterMethod != null) { try { setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } } else { Field field = ReflectUtil.getField(declaration.getName(), target); if (field == null) { throw new ActivitiIllegalArgumentException("Field definition uses non-existing field '" + declaration.getName() + "' on class " + target.getClass().getName()); } // Check if the delegate field's type is correct if (!fieldTypeCompatible(declaration, field)) { throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName() + ", while expecting " + field.getType().getName()); } ReflectUtil.setField(field, target, declaration.getValue()); } }
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target, boolean throwExceptionOnMissingField) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal acces when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); Field field = ReflectUtil.getField(declaration.getName(), target); if(field == null) { if (throwExceptionOnMissingField) { throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName()); } else { return; throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName()
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); if (setterMethod != null) { try { setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } } else { Field field = ReflectUtil.getField(declaration.getName(), target); if (field == null) { throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName()); } // Check if the delegate field's type is correct if (!fieldTypeCompatible(declaration, field)) { throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName() + ", while expecting " + field.getType().getName()); } ReflectUtil.setField(field, target, declaration.getValue()); } }
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); if (setterMethod != null) { try { setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } } else { Field field = ReflectUtil.getField(declaration.getName(), target); if (field == null) { throw new ActivitiIllegalArgumentException("Field definition uses non-existing field '" + declaration.getName() + "' on class " + target.getClass().getName()); } // Check if the delegate field's type is correct if (!fieldTypeCompatible(declaration, field)) { throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName() + ", while expecting " + field.getType().getName()); } ReflectUtil.setField(field, target, declaration.getValue()); } }
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); if(setterMethod != null) { try { setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal acces when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } } else { Field field = ReflectUtil.getField(declaration.getName(), target); if(field == null) { throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName()); } // Check if the delegate field's type is correct if(!fieldTypeCompatible(declaration, field)) { throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName() + ", while expecting " + field.getType().getName()); } ReflectUtil.setField(field, target, declaration.getValue()); } }
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); if(setterMethod != null) { try { setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal acces when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } } else { Field field = ReflectUtil.getField(declaration.getName(), target); if(field == null) { throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName()); } // Check if the delegate field's type is correct if(!fieldTypeCompatible(declaration, field)) { throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName() + ", while expecting " + field.getType().getName()); } ReflectUtil.setField(field, target, declaration.getValue()); } }
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target, boolean throwExceptionOnMissingField) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal acces when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); Field field = ReflectUtil.getField(declaration.getName(), target); if(field == null) { if (throwExceptionOnMissingField) { throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName()); } else { return; throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName()
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target, boolean throwExceptionOnMissingField) { Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass()); setterMethod.invoke(target, declaration.getValue()); } catch (IllegalArgumentException e) { throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (IllegalAccessException e) { throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e); } catch (InvocationTargetException e) { throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e); Field field = ReflectUtil.getField(declaration.getName(), target); if (field == null) { if (throwExceptionOnMissingField) { throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName()); } else { return; throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName()