private static void callSetter(Object target, String propertyName, Object parameter) throws PropertyException { Method setter = getSetter(target, propertyName); try { setter.invoke(target, parameter); } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
private static void callSetter(Object target, String propertyName, Object parameter) throws PropertyException { Method setter = getSetter(target, propertyName); try { setter.invoke(target, parameter); } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
private static void callSetter(Object target, String propertyName, Object parameter) throws PropertyException { Method setter = getSetter(target, propertyName); try { setter.invoke(target, new Object[] {parameter}); } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
private static void callSetter(Object target, String propertyName, Object parameter) throws PropertyException { Method setter = getSetter(target, propertyName); try { setter.invoke(target, new Object[] {parameter}); } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
/** * Set a direct property on the target object. Conversions from propertyValue to the proper destination type * are performed whenever possible. * @param target the target object on which to set the property. * @param propertyName the name of the property to set. * @param propertyValue the value of the property to set. * @throws PropertyException if an error happened while trying to set the property. */ private static void setDirectProperty(Object target, String propertyName, Object propertyValue) throws PropertyException { Method setter = getSetter(target, propertyName); Class<?> parameterType = setter.getParameterTypes()[0]; try { if (propertyValue != null) { Object transformedPropertyValue = transform(propertyValue, parameterType); setter.invoke(target, transformedPropertyValue); } else { setter.invoke(target); } } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
/** * Set a direct property on the target object. Conversions from propertyValue to the proper destination type * are performed whenever possible. * @param target the target object on which to set the property. * @param propertyName the name of the property to set. * @param propertyValue the value of the property to set. * @throws PropertyException if an error happened while trying to set the property. */ private static void setDirectProperty(Object target, String propertyName, Object propertyValue) throws PropertyException { Method setter = getSetter(target, propertyName); Class parameterType = setter.getParameterTypes()[0]; try { if (propertyValue != null) { Object transformedPropertyValue = transform(propertyValue, parameterType); setter.invoke(target, new Object[] {transformedPropertyValue}); } else { setter.invoke(target, new Object[] {null}); } } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
/** * Set a direct property on the target object. Conversions from propertyValue to the proper destination type * are performed whenever possible. * @param target the target object on which to set the property. * @param propertyName the name of the property to set. * @param propertyValue the value of the property to set. * @throws PropertyException if an error happened while trying to set the property. */ private static void setDirectProperty(Object target, String propertyName, Object propertyValue) throws PropertyException { Method setter = getSetter(target, propertyName); Class<?> parameterType = setter.getParameterTypes()[0]; try { if (propertyValue != null) { Object transformedPropertyValue = transform(propertyValue, parameterType); setter.invoke(target, transformedPropertyValue); } else { setter.invoke(target); } } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }
/** * Set a direct property on the target object. Conversions from propertyValue to the proper destination type * are performed whenever possible. * @param target the target object on which to set the property. * @param propertyName the name of the property to set. * @param propertyValue the value of the property to set. * @throws PropertyException if an error happened while trying to set the property. */ private static void setDirectProperty(Object target, String propertyName, Object propertyValue) throws PropertyException { Method setter = getSetter(target, propertyName); Class parameterType = setter.getParameterTypes()[0]; try { if (propertyValue != null) { Object transformedPropertyValue = transform(propertyValue, parameterType); setter.invoke(target, new Object[] {transformedPropertyValue}); } else { setter.invoke(target, new Object[] {null}); } } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyName + "' is not accessible", ex); } catch (InvocationTargetException ex) { throw new PropertyException("property '" + propertyName + "' access threw an exception", ex); } }