/** * Find and execute the getter method on the target class for the supplied property name. If no such method is found, a * NoSuchMethodException is thrown. * * @param javaPropertyName the name of the property whose getter is to be invoked, in the order they are to be tried * @param target the object on which the method is to be invoked * @return the property value (the result of the getter method call) * @throws NoSuchMethodException if a matching method is not found. * @throws SecurityException if access to the information is denied. * @throws InvocationTargetException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Object invokeGetterMethodOnTarget( String javaPropertyName, Object target ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { String[] methodNamesArray = findMethodNames("get" + javaPropertyName); return invokeBestMethodOnTarget(methodNamesArray, target); }
/** * Find and execute the best setter method on the target class for the supplied property name and the supplied list of * arguments. If no such method is found, a NoSuchMethodException is thrown. * <P> * This method is unable to find methods with signatures that include both primitive arguments <i>and</i> arguments that are * instances of <code>Number</code> or its subclasses. * </p> * * @param javaPropertyName the name of the property whose setter is to be invoked, in the order they are to be tried * @param target the object on which the method is to be invoked * @param argument the new value for the property * @return the result of the setter method, which is typically null (void) * @throws NoSuchMethodException if a matching method is not found. * @throws SecurityException if access to the information is denied. * @throws InvocationTargetException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Object invokeSetterMethodOnTarget( String javaPropertyName, Object target, Object argument ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { String[] methodNamesArray = findMethodNames("set" + javaPropertyName); return invokeBestMethodOnTarget(methodNamesArray, target, argument); }