commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser ASTEmptyFunction.java
Date Tue, 18 Feb 2003 20:22:00 GMT
geirm       2003/02/18 12:22:00

  Modified:    jexl/src/java/org/apache/commons/jexl/parser
                        ASTEmptyFunction.java
  Log:
  modified patch from Tim O'Brien to add full collections support.  Only
  catch was that Map ! instanceof Collection so...
  
  Revision  Changes    Path
  1.2       +9 -5      jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTEmptyFunction.java
  
  Index: ASTEmptyFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTEmptyFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ASTEmptyFunction.java	26 Apr 2002 04:23:14 -0000	1.1
  +++ ASTEmptyFunction.java	18 Feb 2003 20:22:00 -0000	1.2
  @@ -56,13 +56,14 @@
   
   import org.apache.commons.jexl.JexlContext;
   
  -import java.util.List;
  +import java.util.Collection;
   import java.util.Map;
   
   /**
    *  function to see if reference doesn't exist in context
    *
    *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  + *  @author <a href="mailto:tobrien@apache.org">Tim O'Brien</a>
    *  @version $Id$
    */
   public class ASTEmptyFunction extends SimpleNode
  @@ -107,11 +108,14 @@
               if (o.getClass().isArray() && ((Object[])o).length == 0)
                   return Boolean.TRUE;
   
  -            if (o instanceof Map && ((Map)o).isEmpty())
  +            if (o instanceof Collection && ((Collection)o).isEmpty())
                   return Boolean.TRUE;
   
  -            if (o instanceof List && ((List)o).isEmpty())
  -                return Boolean.TRUE;
  +			/*
  +			 *  Map isn't a collection
  +			 */
  +			if (o instanceof Map && ((Map)o).isEmpty())
  +				return Boolean.TRUE;
   
               return Boolean.FALSE;
           }
  
  
  

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


Mime
View raw message