diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java index c88a2dbe2..8ec37c30f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java @@ -43,7 +43,7 @@ public class DefaultConfiguration implements Configuration /** * Instantiates a DefaultConfiguration. - * @param aName + * @param aName the name for this DefaultConfiguration. */ public DefaultConfiguration(String aName) { @@ -71,7 +71,8 @@ public class DefaultConfiguration implements Configuration /** @see Configuration */ public Configuration[] getChildren() { - return (Configuration[]) mChildren.toArray(new Configuration[mChildren.size()]); + return (Configuration[]) mChildren.toArray( + new Configuration[mChildren.size()]); } /** @see Configuration */ @@ -80,11 +81,20 @@ public class DefaultConfiguration implements Configuration return mName; } + /** + * Makes a configuration a child of this configuration. + * @param aConfiguration the child configuration. + */ public void addChild(Configuration aConfiguration) { mChildren.add(aConfiguration); } + /** + * Adds an attribute to this configuration. + * @param aName the name of the attribute. + * @param aValue the value of the attribute. + */ public void addAttribute(String aName, String aValue) { mAttributeMap.put(aName, aValue); diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java index 118247022..329354207 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java @@ -44,6 +44,7 @@ import org.apache.commons.beanutils.converters.StringArrayConverter; /** * A Java Bean that implements the component lifecycle interfaces by * calling the bean's setters for all configration attributes. + * @author lkuehne */ public class AutomaticBean implements Configurable, Contextualizable @@ -129,16 +130,21 @@ public class AutomaticBean } catch (InvocationTargetException e) { throw new CheckstyleException( - "for " + aConfiguration.getName() + " unable to set " + key - + " with " + value); + "for " + aConfiguration.getName() + " unable to set " + + key + " with " + value); } catch (IllegalAccessException e) { throw new CheckstyleException( - "cannot access " + key + " in " + this.getClass().getName()); + "cannot access " + key + " in " + + this.getClass().getName()); } } } + /** + * Implements the Contextualizable interface using bean introspection. + * @see Contextualizable + */ public void contextualize(Context aContext) throws CheckstyleException { @@ -157,7 +163,8 @@ public class AutomaticBean } catch (IllegalAccessException e) { throw new CheckstyleException( - "cannot access " + key + " in " + this.getClass().getName()); + "cannot access " + key + " in " + + this.getClass().getName()); } } } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Configurable.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Configurable.java index 0a41bc103..c0ebb6749 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Configurable.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Configurable.java @@ -28,7 +28,8 @@ public interface Configurable { /** * Configures this component. - * @param aConfiguration the configuration to use + * @param aConfiguration the configuration to use. + * @throws CheckstyleException if there is a configuration error. */ void configure(Configuration aConfiguration) throws CheckstyleException; } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Context.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Context.java index 8c8dbfc64..2e77e39d4 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Context.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Context.java @@ -27,7 +27,16 @@ package com.puppycrawl.tools.checkstyle.api; */ public interface Context { - Object get(String key); + /** + * Searches for the value with the specified attribute key in this context. + * @param aKey the attribute key. + * @return the value in this context with the specified attribute key value. + */ + Object get(String aKey); + /** + * Returns the names of all atttributes of this context. + * @return the names of all atttributes of this context. + */ String[] getAttributeNames(); } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Contextualizable.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Contextualizable.java index b50912b51..9b50e60a6 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Contextualizable.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Contextualizable.java @@ -31,7 +31,8 @@ public interface Contextualizable { /** * Sets the context for this Component. - * @param aContext the context + * @param aContext the context. + * @throws CheckstyleException if there is a contextualization error. */ void contextualize(Context aContext) throws CheckstyleException; }