"Method '" + aMethod + "' was not configured. ");
}
-
-
- /**
- * Creates the name of a setter based on the name of the setter without the
- * "set" prefix.
- *
- * @param aName
- * Setter name.
- * @return Setter name.
- */
- private String createxSetterName(String aName) {
- return "set" + aName.substring(0, 1).toUpperCase() + aName.substring(1);
- }
-
/**
* Adds a given setter name to the setters.
*
* @throws IllegalArgumentException
* In case no setter is found or multiple setters are found.
*/
- public SetterConfiguration add(final Class aType) {
+ public SetterConfiguration addSetter(final Class aType) {
List<Method> result = new ArrayList<Method>();
CollectionFilter.filter(getAllSetters(_class, _publicOnly), result,
new Condition<Method>() {
return result;
}
- private static ParameterValues createParameterValues(Method method) {
- // TODO generalize to multiple parameters.
- return new ParameterValues(
- new String[] { method.getName() }, new Class[] { method
- .getParameterTypes()[0] });
+ private static ParameterValues createParameterValues(Method aMethod) {
+
+ Class[] paramTypes = aMethod.getParameterTypes();
+ String[] paramNames = new String[paramTypes.length];
+ for (int i = 0; i < paramTypes.length; i++) {
+ paramNames[i] = aMethod.getName() + "." + i;
+ }
+ return new ParameterValues(paramNames, paramTypes);
}
private static final List<Method> getAllMethods(Class aClass) {
+ "' found");
}
- /**
- * Gets the setter name for a given setter method. This is the name of the
- * setter without the "set" prefix and with the first character converted to
- * lowercase.
- *
- * @param aMethod
- * Method.
- * @return Setter name.
- */
- private static String getxSetterName(Method aMethod) {
- String result = aMethod.getName().substring(3);
- return result.substring(0, 1).toLowerCase() + result.substring(1);
- }
-
public List<Method> getSetters() {
return new ArrayList<Method>(_setters.keySet());
}