[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core UseListTag.jav
From:       jstrachan () apache ! org
Date:       2002-09-30 17:46:59
[Download RAW message or body]

jstrachan    2002/09/30 10:46:59

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/core
                        UseListTag.java
  Log:
  Removed some unnecessary debugging code and patched to make use of the new \
getAttributeType() method of DynaTag so that a DynaTag can work with native \
Expression objects and perform its own coercion.  
  Revision  Changes    Path
  1.2       +12 -14    \
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseListTag.java
  
  Index: UseListTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseListTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UseListTag.java	30 Sep 2002 17:40:16 -0000	1.1
  +++ UseListTag.java	30 Sep 2002 17:46:59 -0000	1.2
  @@ -85,21 +85,22 @@
       }
       
   
  +    // DynaTag interface
  +    //-------------------------------------------------------------------------    \
  +    public Class getAttributeType(String name) throws Exception {
  +        if (name.equals("items")) {
  +            return Expression.class;
  +        }
  +        return super.getAttributeType(name);
  +    }
  +
  +
       // Implementation methods
       //-------------------------------------------------------------------------    \
  +    
       protected void setBeanProperties(Object bean, Map attributes) throws Exception \
                {
  -        Object value = attributes.remove("items");
  -        System.out.println( "value: " + value );
  +        items = (Expression) attributes.remove("items");
           super.setBeanProperties(bean, attributes);
  -        
  -        // #### @todo use same algorithm as evaluateAsIterator()
  -        List list = getList();
  -        if (value instanceof Iterator) {
  -            Iterator iter = (Iterator) value;
  -            while (iter.hasNext()) {
  -                list.add( iter.next() );
  -            }
  -        }
       }
       
       protected void processBean(String var, Object bean) throws Exception {
  @@ -107,9 +108,6 @@
           
           List list = getList();
   
  -        System.out.println( "Created list: " + list + " with items: " + items );
  -        
  -        
           // if the items variable is specified lets append all the items
           if (items != null) {
               Iterator iter = items.evaluateAsIterator(context);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic