Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/util
In directory 
james.mmbase.org:/tmp/cvs-serv8773/applications/taglib/src/org/mmbase/bridge/jsp/taglib/util

Modified Files:
        Attribute.java 
Log Message:
Fixed comments and removed JspException which are not thrown


See also: 
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/util


Index: Attribute.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/util/Attribute.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- Attribute.java      11 Apr 2008 15:17:20 -0000      1.35
+++ Attribute.java      25 Apr 2008 15:37:58 -0000      1.36
@@ -24,7 +24,7 @@
  * decide not to call the set-function of the attribute (in case of 
tag-instance-reuse).
  *
  * @author Michiel Meeuwissen
- * @version $Id: Attribute.java,v 1.35 2008/04/11 15:17:20 michiel Exp $
+ * @version $Id: Attribute.java,v 1.36 2008/04/25 15:37:58 nklasens Exp $
  * @since   MMBase-1.7
  */
 
@@ -44,6 +44,9 @@
     /**
      * This is the function for public use. It takes the string and returns an 
Attribute, creating
      * a new one if it is not in the Attribute cache.
+     * @param at unparsed attribute
+     * @return Attribute
+     * @throws JspTagException when parsing of attributes fails
      */
     public static final Attribute getAttribute(final String at) throws 
JspTagException {
         if (at == null) return NULL;
@@ -73,6 +76,8 @@
 
     /**
      * The constructor is protected, construction is done by the cache.
+     * @param at unparsed attribute
+     * @throws JspTagException when parsing of attributes fails
      */
     protected Attribute(String at) throws JspTagException {
         attribute = at;
@@ -86,8 +91,10 @@
     /**
      * Appends the evaluated Attribute to StringBuilder
      *
-     * @param tag The tag relative to which the variable evalutations must be 
done
+     * @param tag The tag relative to which the variable evaluations must be 
done
      *            (normally 'this' in a Tag implementation)
+     * @param buffer buffer to write attribute value to
+     * @throws JspTagException when parsing of attributes fails
      */
 
     public void appendValue(ContextReferrerTag tag, StringBuilder buffer) 
throws JspTagException {
@@ -103,6 +110,9 @@
 
     /**
      * Returns the evaluated Attribute as an Object. Can also be null.
+     * @param tag tag with the attribute
+     * @return Value of attribute
+     * @throws JspTagException when parsing of attributes fails
      */
     public Object getValue(ContextReferrerTag tag) throws JspTagException {
         if (! containsVars) return attribute;
@@ -119,6 +129,9 @@
 
     /**
      * Returns the evaluated Attribute as a String. This is never null (empty 
string in that case)..
+     * @param tag tag with the attribute
+     * @return Value of attribute
+     * @throws JspTagException when parsing of attributes fails
      */
     public String getString(ContextReferrerTag tag) throws JspTagException {
         return Casting.toString(getValue(tag));
@@ -126,6 +139,10 @@
 
     /**
      * Returns the evaluated Attribute as a int
+     * @param tag tag with the attribute
+     * @param def default value
+     * @return Value of attribute
+     * @throws JspTagException when parsing of attributes fails
      */
 
     public int getInt(ContextReferrerTag tag, int def) throws JspTagException {
@@ -137,9 +154,12 @@
     }
 
     /**
-     * Returns the evaluated Attribute as a List (evalatued to comma-seperated 
String, which is 'split').
+     * Returns the evaluated Attribute as a List (evaluated to comma-separated 
String, which is 'split').
      * The List is empty if getValue would give empty String or null.
      *
+     * @param tag tag with the attribute
+     * @return Value of attribute
+     * @throws JspTagException when parsing of attributes fails
      */
 
     public List<String> getList(ContextReferrerTag tag) throws JspTagException 
{
@@ -148,11 +168,13 @@
     }
 
     /**
-     * Returns the evaluated Attribute as a boolen (depending on if getValue 
returns one of the
-     * strings 'true' or 'false' (case insensitve)).
+     * Returns the evaluated Attribute as a boolean (depending on if getValue 
returns one of the
+     * strings 'true' or 'false' (case insensitive)).
      *
      * @param  def If the string is not "true" or "false', then this value is 
returned.
+     * @param tag tag with the attribute
      * @return true or false
+     * @throws JspTagException when parsing of attributes fails
      */
 
     public boolean getBoolean(ContextReferrerTag tag, boolean def) throws 
JspTagException {
@@ -169,6 +191,7 @@
 
     /**
      * String representation of this Attribute object (for debugging)
+     * @see java.lang.Object#toString()
      */
     public String toString() {
         return "att: " + attribute.toString() + " parts: " + attributeParts;
@@ -178,14 +201,15 @@
      * Parses this attribute into list of 'attributeparts'. This is
      * the heart of the Attribute class.  The method [EMAIL PROTECTED] 
#getValue}
      * will concatenate them together again (after evaluation).
+     * @throws JspTagException when parsing of attributes fails
      */
 
     protected void parse() throws JspTagException {
-        // search all occurences of $
+        // search all occurrences of $
         int foundPos     = attribute.indexOf('$');
         if (foundPos == -1) {
             containsVars = false;
-            return; // if none, return imediately.
+            return; // if none, return immediately.
         } else {
             attributeParts = new ArrayList<Part>();
             containsVars = true;
@@ -206,7 +230,7 @@
             char c = attribute.charAt(foundPos);
             if (c == '{' || c == '[') { // using parentheses
                 char close = (c == '{' ? '}' : ']');
-                // find matching closing parenthes
+                // find matching closing parentheses
                 pos = ++foundPos;
                 int opened = 1;
                 while (opened > 0) {
@@ -270,11 +294,13 @@
 
         /**
          * Returns the 'type' of a Part as a string. For debugging use.
+         * @return the 'type'
          */
         abstract protected String getType();
 
         /**
          * String representation of this AttributePart (for debugging)
+         * @see java.lang.Object#toString()
          */
         public String toString() {
             return "(" + getType() + "/" + part.toString() + ")";
@@ -362,7 +388,7 @@
     static class StringPart extends Part {
         StringPart(String o) {  part = o; }
         protected String getType() { return "String"; }
-        final Object getValue(ContextReferrerTag tag) throws JspTagException {
+        final Object getValue(ContextReferrerTag tag) {
             return part;
         }
     }
@@ -408,8 +434,8 @@
  */
 final class NullAttribute extends Attribute {
     NullAttribute() { }
-    public final Object getValue(ContextReferrerTag tag)  throws 
JspTagException { return null; }
-    public final String getString(ContextReferrerTag tag) throws 
JspTagException { return ""; }
-    public final void   appendValue(ContextReferrerTag tag, StringBuilder 
buffer) throws JspTagException { return; }
+    public final Object getValue(ContextReferrerTag tag) { return null; }
+    public final String getString(ContextReferrerTag tag) { return ""; }
+    public final void   appendValue(ContextReferrerTag tag, StringBuilder 
buffer) { return; }
     public final String toString() { return "NULLATTRIBUTE"; }
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to