You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by to...@apache.org on 2004/06/13 01:53:17 UTC

cvs commit: jakarta-commons/jexl/src/java/org/apache/commons/jexl Expression.java ExpressionImpl.java JexlContext.java JexlHelper.java JexlExprResolver.java

tobrien     2004/06/12 16:53:17

  Modified:    jexl/src/java/org/apache/commons/jexl Expression.java
                        ExpressionImpl.java JexlContext.java
                        JexlHelper.java JexlExprResolver.java
  Log:
  Updating JavaDoc in the commons.jexl package.  We need much more
  clarification about pre and post resolvers.
  
  Revision  Changes    Path
  1.5       +13 -5     jakarta-commons/jexl/src/java/org/apache/commons/jexl/Expression.java
  
  Index: Expression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/Expression.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Expression.java	28 Feb 2004 13:45:20 -0000	1.4
  +++ Expression.java	12 Jun 2004 23:53:17 -0000	1.5
  @@ -18,20 +18,28 @@
   
   
   /**
  - *  Inferface for expression object.
  + * Represents a single JEXL expression.  This simple interface
  + * provides access to the underlying expression through getExpression(), 
  + * and it provides hooks to add a pre- and post- expression resolver.   
    *
  - *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  - *  @version $Id$
  + * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  + * @version $Id$
    */
   public interface Expression
   {
       /**
  -     *  Evaluates the expression, returning the return value;
  +     * Evaluates the expression with the variables contained in the
  +     * supplied {@link JexlContext}. 
  +     * 
  +     * @param context A JexlContext containing variables.
  +     * @return The result of this evaluation
        */
       public Object evaluate(JexlContext context) throws Exception;
   
       /**
  -     *  returns the expression used
  +     * Returns the JEXL expression this Expression was created with.
  +     * 
  +     * @return The JEXL expression to be evaluated
        */
       public String getExpression();
   
  
  
  
  1.7       +3 -1      jakarta-commons/jexl/src/java/org/apache/commons/jexl/ExpressionImpl.java
  
  Index: ExpressionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/ExpressionImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ExpressionImpl.java	28 Feb 2004 13:45:20 -0000	1.6
  +++ ExpressionImpl.java	12 Jun 2004 23:53:17 -0000	1.7
  @@ -58,6 +58,8 @@
       /**
        *  evaluate the expression and return the value
        *
  +     * @todo Under what conditions will pre and post resolvers be called
  +     *
        *  @param context Context containing objects/data used for evaluation
        *  @return value of expression
        */
  
  
  
  1.4       +18 -3     jakarta-commons/jexl/src/java/org/apache/commons/jexl/JexlContext.java
  
  Index: JexlContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/JexlContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JexlContext.java	28 Feb 2004 13:45:20 -0000	1.3
  +++ JexlContext.java	12 Jun 2004 23:53:17 -0000	1.4
  @@ -18,14 +18,29 @@
   import java.util.Map;
   
   /**
  - *  Right now, just steal the j.u.Map interface as the JexlContext interface
  - *  this might be a pain going forward - we might want to do something simpler
  + * Holds a Map of variables which are referenced in a JEXL expression.
    *
    *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
    *  @version $Id$
    */
   public interface JexlContext
   {
  +	/**
  +	 * Replaces variables in a JexlContext with the variables contained
  +	 * in the supplied Map.  When setVars() is called on a JexlContext,
  +	 * it clears the current Map and puts each entry of the
  +	 * supplied Map into the current variable Map. 
  +	 * 
  +	 * @param vars Contents of vars will be replaced with the content of this Map
  +	 */
       public void setVars(Map vars);
  +    
  +    /**
  +     * Retrives the Map of variables associated with this JexlContext.  The
  +     * keys of this map correspond to variable names referenced in a
  +     * JEXL expression.
  +     * 
  +     * @return A reference to the variable Map associated with this JexlContext.
  +     */
       public Map getVars();
   }
  
  
  
  1.4       +19 -12    jakarta-commons/jexl/src/java/org/apache/commons/jexl/JexlHelper.java
  
  Index: JexlHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/JexlHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JexlHelper.java	28 Feb 2004 13:45:20 -0000	1.3
  +++ JexlHelper.java	12 Jun 2004 23:53:17 -0000	1.4
  @@ -19,11 +19,10 @@
   import org.apache.commons.jexl.context.HashMapContext;
   
   /**
  - *  Helper to create contexts.  Really no reason right now why you just can't
  - *  instantiate the HashMapContext on your own, but maybe we make this return
  - *  a context factory to let apps override....
  - *
  - *  Then you can do all sorts of goofy contexts (backed by databases, LDAP, etc)
  + *  Helper to create a context.  In the current implementation of JEXL, there
  + *  is one implementation of JexlContext - {@link HashMapContext}, and there
  + *  is no reason not to directly instantiate {@link HashMapContext} in your
  + *  own application.
    *
    *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
    *  @version $Id$
  @@ -32,19 +31,27 @@
   {
       protected static JexlHelper helper = new JexlHelper();
   
  +    protected static JexlHelper getInstance()
  +    {
  +        return helper;
  +    }
  +
  +    /**
  +     * Returns a new {@link JexlContext}.
  +     * @return a new JexlContext
  +     */
       public static JexlContext createContext()
       {
           return getInstance().newContext();
       }
   
  +    /**
  +     * Creates and returns a new {@link JexlContext}.  The current implementation
  +     * creates a new instance of {@link HashMapContext}.
  +     * @return a new JexlContext
  +     */
       protected JexlContext newContext()
       {
           return new HashMapContext();
       }
  -
  -    protected static JexlHelper getInstance()
  -    {
  -        return helper;
  -    }
  -
   }
  
  
  
  1.2       +3 -1      jakarta-commons/jexl/src/java/org/apache/commons/jexl/JexlExprResolver.java
  
  Index: JexlExprResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/JexlExprResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JexlExprResolver.java	13 Jun 2002 16:09:32 -0000	1.1
  +++ JexlExprResolver.java	12 Jun 2004 23:53:17 -0000	1.2
  @@ -4,6 +4,7 @@
    *  A Resolver allows custom resolution of the expression, and can be
    *  added in front of the jexl engine, or after in the evaluation
    *
  + *  @todo This needs to be explained in detail.  Why do this?
    *  @author <a href="mailto:geirm@adeptra.com">Geir Magnusson Jr.</a>
    *  @version $Id$
    */
  @@ -14,6 +15,7 @@
       /**
        *  evaluates an expression against the context
        *
  +     *  @todo Must detail the expectations and effects of this resolver.
        *  @param context current data context
        *  @param expression expression to evauluate
        *  @return value (may be null) po the NO_VALUE object to
  
  
  

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