- private String createSetterName(String aName) {
- return "set" + aName.substring(0, 1).toUpperCase()
- + aName.substring(1);
+ public SetterConfiguration add(final String aName) {
+ int oldlen = setters.size();
+ List<Method> methods = new ArrayList<Method>();
+ CollectionFilter.filter(getAllSetters(_class, publicOnly), methods,
+ new Condition<Method>() {
+ @Override
+ public boolean matches(Method aObject) {
+ return aObject.getName().equals(aName);
+ }
+ });
+
+ if (methods.size() == 0) {
+ throw new IllegalArgumentException("Method '" + aName
+ + "' not found in " + _class.getName());
+ }
+
+ // TODO is it possible to get more than one setter here in case the subclass overrides
+ // the baseclass method?
+ setters.put(methods.get(0), createParameterValues(methods.get(0)));
+
+ return this;