[maven-release-plugin] copy for tag wamblee-utils-0.2
[utils] / system / general / src / main / java / org / wamblee / system / adapters / SetterConfiguration.java
index f81c4a4bc405837d893f5e021635a3b3bd1e0137..57323a54b409531f53667e9d771c4f9d542a0060 100644 (file)
@@ -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<Method> result = new ArrayList<Method>();
                CollectionFilter.filter(getAllSetters(_class, _publicOnly), result,
                                new Condition<Method>() {
@@ -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<Method> 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<Method> getSetters() { 
                return new ArrayList<Method>(_setters.keySet());
        }