commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ply...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression ExpressionSupport.java
Date Sat, 13 Jul 2002 01:03:28 GMT
plynch      2002/07/12 18:03:28

  Modified:    jelly/src/java/org/apache/commons/jelly/expression
                        ExpressionSupport.java
  Log:
  o Now supports returning an iterator from a collection
  
  Revision  Changes    Path
  1.6       +15 -10    jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/ExpressionSupport.java
  
  Index: ExpressionSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/ExpressionSupport.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExpressionSupport.java	28 Jun 2002 03:30:24 -0000	1.5
  +++ ExpressionSupport.java	13 Jul 2002 01:03:27 -0000	1.6
  @@ -56,12 +56,13 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  - * 
  + *
    * $Id$
    */
   package org.apache.commons.jelly.expression;
   
   import java.util.Collections;
  +import java.util.Collection;
   import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.List;
  @@ -73,7 +74,7 @@
   
   import org.apache.commons.jelly.JellyContext;
   
  -/** <p><code>ExpressionSupport</code> 
  +/** <p><code>ExpressionSupport</code>
     * an abstract base class for Expression implementations
     * which provides default implementations of some of the
     * typesafe evaluation methods.</p>
  @@ -84,7 +85,7 @@
   public abstract class ExpressionSupport implements Expression {
   
       protected static final Iterator EMPTY_ITERATOR = Collections.EMPTY_LIST.iterator();
  -    
  +
       // inherit javadoc from interface
       public String evaluateAsString(JellyContext context) {
           Object value = evaluate(context);
  @@ -93,7 +94,7 @@
           }
           return null;
       }
  -    
  +
       // inherit javadoc from interface
       public boolean evaluateAsBoolean(JellyContext context) {
           Object value = evaluate(context);
  @@ -123,7 +124,7 @@
           }
           return false;
       }
  -    
  +
       // inherit javadoc from interface
       public Iterator evaluateAsIterator(JellyContext context) {
           Object value = evaluate(context);
  @@ -147,6 +148,10 @@
           }
           else if ( value instanceof Enumeration ) {
               return new EnumerationIterator((Enumeration ) value);
  +        }
  +        else if ( value instanceof Collection ) {
  +          Collection collection = (Collection) value;
  +          return collection.iterator();
           }
           else {
               // XXX: should we return single iterator?
  
  
  

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


Mime
View raw message