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

Modified Files:
        Attribute.java 
Log Message:
added a way to specify an attribute as 'empty equivalant with absent'


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.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- Attribute.java      25 Apr 2008 15:37:58 -0000      1.36
+++ Attribute.java      17 Jul 2008 10:58:08 -0000      1.37
@@ -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.36 2008/04/25 15:37:58 nklasens Exp $
+ * @version $Id: Attribute.java,v 1.37 2008/07/17 10:58:08 michiel Exp $
  * @since   MMBase-1.7
  */
 
@@ -45,13 +45,23 @@
      * 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
+     * @param interpretEmptyAsAbsent whether the empty attribute should be 
interpreted as no
+     * attribute at all (default to false).
      * @return Attribute
      * @throws JspTagException when parsing of attributes fails
+     * @since MMBase-1.9
      */
-    public static final Attribute getAttribute(final String at) throws 
JspTagException {
+    public static final Attribute getAttribute(final String at, boolean 
interpretEmptyAsAbsent) throws JspTagException {
         if (at == null) return NULL;
+        if (interpretEmptyAsAbsent && at.length() == 0) {
+            log.info("Interpreting " + at + " as NULL");
+            return NULL;
+        }
         return cache.getAttribute(at);
     }
+    public static final Attribute getAttribute(final String at) throws 
JspTagException {
+        return getAttribute(at, false);
+    }
 
     /**
      * Whether the attribute contains any $-vars.
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to