Removed DOCUMENT ME comments that were generated and applied source code
[utils] / system / general / src / main / java / org / wamblee / system / adapters / SetterConfiguration.java
index d9c83bb45b5b50249c88648ce16a8eada013f795..af9da338a5c9526b8375a5ec4b0187d011c752e7 100644 (file)
@@ -44,45 +44,34 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-
 /**
- * Represents the configuration for exposing the setters of a class as
- * required interfaces.
- *
+ * Represents the configuration for exposing the setters of a class as required
+ * interfaces.
+ * 
  * @author Erik Brakkee
  */
 public class SetterConfiguration {
-    /**
-     * DOCUMENT ME!
-     */
     private Class _class;
 
-    /**
-     * DOCUMENT ME!
-     */
     private boolean publicOnly;
 
-    /**
-     * DOCUMENT ME!
-     */
     private Map<Method, ParameterValues> setters;
 
-/**
-         * Constructs the setter configuration. By default no setters are added. 
-         
-         * @param aClass
-         *            Class which is being configured.
-         */
+    /**
+     * Constructs the setter configuration. By default no setters are added.
+     * 
+     * @param aClass
+     *            Class which is being configured.
+     */
     public SetterConfiguration(Class aClass) {
-        _class         = aClass;
-        publicOnly     = true;
-        setters        = new HashMap<Method, ParameterValues>();
+        _class = aClass;
+        publicOnly = true;
+        setters = new HashMap<Method, ParameterValues>();
     }
 
     /**
      * Makes sure that all available setters are used.
-     *
-     * @return DOCUMENT ME!
+     * 
      */
     public SetterConfiguration initAllSetters() {
         setters.clear();
@@ -95,13 +84,12 @@ public class SetterConfiguration {
     }
 
     /**
-     * Called to set whether non-public setters are also used. By
-     * default only public setters are used. The currently selected setters
-     * remain chosen.
-     *
-     * @param aIsNonPublic Non public flag.
-     *
-     * @return DOCUMENT ME!
+     * Called to set whether non-public setters are also used. By default only
+     * public setters are used. The currently selected setters remain chosen.
+     * 
+     * @param aIsNonPublic
+     *            Non public flag.
+     * 
      */
     public SetterConfiguration setNonPublic(boolean aIsNonPublic) {
         publicOnly = !aIsNonPublic;
@@ -111,7 +99,7 @@ public class SetterConfiguration {
 
     /**
      * Removes all setters.
-     *
+     * 
      * @return Reference to the current object to allow call chaining.
      */
     public SetterConfiguration clear() {
@@ -122,12 +110,12 @@ public class SetterConfiguration {
 
     /**
      * Removes a setter from the set of methods.
-     *
-     * @param aName Name of the setter to remove.
-     *
+     * 
+     * @param aName
+     *            Name of the setter to remove.
+     * 
      * @return Reference to the current object to allow call chaining.
-     *
-     * @throws IllegalArgumentException DOCUMENT ME!
+     * 
      */
     public SetterConfiguration remove(String aName) {
         for (Method method : setters.keySet()) {
@@ -144,18 +132,17 @@ public class SetterConfiguration {
 
     /**
      * Removes the method from the set of methods.
-     *
-     * @param aMethod Method to remove.
-     *
+     * 
+     * @param aMethod
+     *            Method to remove.
+     * 
      * @return
-     *
-     * @throws RuntimeException DOCUMENT ME!
-     * @throws IllegalArgumentException DOCUMENT ME!
+     * 
      */
     public SetterConfiguration remove(Method aMethod) {
         if (!aMethod.getDeclaringClass().isAssignableFrom(_class)) {
-            throw new RuntimeException("Method " + aMethod
-                " not found in class " + _class + " or its superclasses");
+            throw new RuntimeException("Method " + aMethod +
+                " not found in class " + _class + " or its superclasses");
         }
 
         for (Method method : setters.keySet()) {
@@ -166,21 +153,21 @@ public class SetterConfiguration {
             }
         }
 
-        throw new IllegalArgumentException("Method '" + aMethod
-            "' was not configured. ");
+        throw new IllegalArgumentException("Method '" + aMethod +
+            "' was not configured. ");
     }
 
     /**
      * Adds a given setter name to the setters.
-     *
-     * @param aName Name of a setter method.
-     *
+     * 
+     * @param aName
+     *            Name of a setter method.
+     * 
      * @return Reference to the current object to allow call chaining.
-     *
-     * @throws IllegalArgumentException DOCUMENT ME!
+     * 
      */
     public SetterConfiguration add(final String aName) {
-        int          oldlen  = setters.size();
+        int oldlen = setters.size();
         List<Method> methods = new ArrayList<Method>();
         CollectionFilter.filter(getAllSetters(_class, publicOnly), methods,
             new Condition<Method>() {
@@ -191,28 +178,30 @@ public class SetterConfiguration {
             });
 
         if (methods.size() == 0) {
-            throw new IllegalArgumentException("Method '" + aName
-                "' not found in " + _class.getName());
+            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? 
+        // 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;
     }
 
     /**
-     * Adds a given setter identified by the type it accepts to the
-     * list of setters.N
-     *
-     * @param aType Type to look for. Note that this must be the exact type as
-     *        autoboxing and autounboxing is not used.
-     *
+     * Adds a given setter identified by the type it accepts to the list of
+     * setters.N
+     * 
+     * @param aType
+     *            Type to look for. Note that this must be the exact type as
+     *            autoboxing and autounboxing is not used.
+     * 
      * @return Reference to the current object to allow call chaining.
-     *
-     * @throws IllegalArgumentException In case no setter is found or multiple
-     *         setters are found.
+     * 
+     * @throws IllegalArgumentException
+     *             In case no setter is found or multiple setters are found.
      */
     public SetterConfiguration addSetter(final Class aType) {
         List<Method> result = new ArrayList<Method>();
@@ -227,9 +216,9 @@ public class SetterConfiguration {
             });
 
         if (result.size() == 0) {
-            throw new IllegalArgumentException("No setter found in class '"
-                + _class.getName() + "' that has a setter with argument type '"
-                aType.getName() + "'");
+            throw new IllegalArgumentException("No setter found in class '" +
+                _class.getName() + "' that has a setter with argument type '" +
+                aType.getName() + "'");
         }
 
         if (result.size() > 1) {
@@ -240,8 +229,8 @@ public class SetterConfiguration {
             }
 
             throw new IllegalArgumentException(
-                "Multiple setters found in class '" + _class.getName()
-                + " that accept type '" + aType.getName() + "': " + setters);
+                "Multiple setters found in class '" + _class.getName() +
+                    " that accept type '" + aType.getName() + "': " + setters);
         }
 
         Method method = result.get(0);
@@ -252,10 +241,8 @@ public class SetterConfiguration {
 
     /**
      * Gets all setters for the current class.
-     *
-     * @param aClass DOCUMENT ME!
-     * @param aPublicOnly DOCUMENT ME!
-     *
+     * 
+     * 
      * @return List of all setters.
      */
     public static List<Method> getAllSetters(Class aClass, boolean aPublicOnly) {
@@ -263,8 +250,8 @@ public class SetterConfiguration {
 
         for (Method method : getAllMethods(aClass)) {
             if (!aPublicOnly || Modifier.isPublic(method.getModifiers())) {
-                if (method.getName().startsWith("set")
-                        && (method.getParameterTypes().length == 1)) {
+                if (method.getName().startsWith("set") &&
+                    (method.getParameterTypes().length == 1)) {
                     method.setAccessible(true);
                     result.add(method);
                 }
@@ -274,15 +261,8 @@ public class SetterConfiguration {
         return result;
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aMethod DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
     private static ParameterValues createParameterValues(Method aMethod) {
-        Class[]  paramTypes = aMethod.getParameterTypes();
+        Class[] paramTypes = aMethod.getParameterTypes();
         String[] paramNames = new String[paramTypes.length];
 
         for (int i = 0; i < paramTypes.length; i++) {
@@ -292,20 +272,13 @@ public class SetterConfiguration {
         return new ParameterValues(paramNames, paramTypes);
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aClass DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
     private static final List<Method> getAllMethods(Class aClass) {
         return ReflectionUtils.getAllMethods(aClass);
     }
 
     /**
      * Gets the required interfaces based on the configured setteres.
-     *
+     * 
      * @return List of required interfaces.
      */
     public List<RequiredInterface> getRequiredInterfaces() {
@@ -320,17 +293,17 @@ public class SetterConfiguration {
 
     /**
      * Invokes all configured setters with the appropriate values.
-     *
-     * @param aScope Scope within which invocation takes place.
-     * @param aObject Object on which the invocation takes place.
-     *
-     * @throws IllegalArgumentException DOCUMENT ME!
-     * @throws SystemAssemblyException DOCUMENT ME!
+     * 
+     * @param aScope
+     *            Scope within which invocation takes place.
+     * @param aObject
+     *            Object on which the invocation takes place.
+     * 
      */
     public void inject(Scope aScope, Object aObject) {
         if (!_class.isInstance(aObject)) {
-            throw new IllegalArgumentException("Object '" + aObject
-                "' is not an instance of " + _class.getName());
+            throw new IllegalArgumentException("Object '" + aObject +
+                "' is not an instance of " + _class.getName());
         }
 
         for (Method method : setters.keySet()) {
@@ -339,25 +312,25 @@ public class SetterConfiguration {
             try {
                 method.invoke(aObject, values.values(aScope));
             } catch (IllegalAccessException e) {
-                throw new SystemAssemblyException("Problem invoking " + method
-                    " with " + values, e);
+                throw new SystemAssemblyException("Problem invoking " + method +
+                    " with " + values, e);
             } catch (InvocationTargetException e) {
-                throw new SystemAssemblyException("Problem invoking " + method
-                    " with " + values, e);
+                throw new SystemAssemblyException("Problem invoking " + method +
+                    " with " + values, e);
             }
         }
     }
 
     /**
-     * Returns the parameter values for allowing detailed configuration
-     * of how parameter values are set.
-     *
-     * @param aMethod Setter name without the "set" prefix with the first
-     *        character converted to lower case.
-     *
+     * Returns the parameter values for allowing detailed configuration of how
+     * parameter values are set.
+     * 
+     * @param aMethod
+     *            Setter name without the "set" prefix with the first character
+     *            converted to lower case.
+     * 
      * @return Parameter values.
-     *
-     * @throws IllegalArgumentException DOCUMENT ME!
+     * 
      */
     public ParameterValues values(String aMethod) {
         for (Method method : setters.keySet()) {
@@ -366,15 +339,10 @@ public class SetterConfiguration {
             }
         }
 
-        throw new IllegalArgumentException("No setter method '" + aMethod
-            "' found");
+        throw new IllegalArgumentException("No setter method '" + aMethod +
+            "' found");
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
     public List<Method> getSetters() {
         return new ArrayList<Method>(setters.keySet());
     }