X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fadapters%2FSetterConfiguration.java;h=57323a54b409531f53667e9d771c4f9d542a0060;hb=ee26f9544a0bf7f49390990c68981676e0e51014;hp=f81c4a4bc405837d893f5e021635a3b3bd1e0137;hpb=9475fda37f427b7e42a2e7822985eddf4b07124b;p=utils diff --git a/system/general/src/main/java/org/wamblee/system/adapters/SetterConfiguration.java b/system/general/src/main/java/org/wamblee/system/adapters/SetterConfiguration.java index f81c4a4b..57323a54 100644 --- a/system/general/src/main/java/org/wamblee/system/adapters/SetterConfiguration.java +++ b/system/general/src/main/java/org/wamblee/system/adapters/SetterConfiguration.java @@ -133,20 +133,6 @@ public class SetterConfiguration { "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. * @@ -185,7 +171,7 @@ public class SetterConfiguration { * @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 result = new ArrayList(); CollectionFilter.filter(getAllSetters(_class, _publicOnly), result, new Condition() { @@ -237,11 +223,14 @@ public class SetterConfiguration { 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 getAllMethods(Class aClass) { @@ -308,20 +297,6 @@ public class SetterConfiguration { + "' 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 getSetters() { return new ArrayList(_setters.keySet()); }