You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/01/13 23:10:50 UTC

svn commit: r898969 - in /tomcat/trunk/java/org/apache/el: MethodExpressionImpl.java ValueExpressionImpl.java parser/AstValue.java parser/Node.java parser/SimpleNode.java

Author: markt
Date: Wed Jan 13 22:10:49 2010
New Revision: 898969

URL: http://svn.apache.org/viewvc?rev=898969&view=rev
Log:
Implement the new ValueExpression.getValueReference() method.
Add some plumbing for MethodExpression.isParametersProvided()
Add some more generics where we can without breaking the code generation

Modified:
    tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java
    tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java
    tomcat/trunk/java/org/apache/el/parser/AstValue.java
    tomcat/trunk/java/org/apache/el/parser/Node.java
    tomcat/trunk/java/org/apache/el/parser/SimpleNode.java

Modified: tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java?rev=898969&r1=898968&r2=898969&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java Wed Jan 13 22:10:49 2010
@@ -317,4 +317,13 @@
     public boolean isLiteralText() {
         return false;
     }
+
+    /**
+     * @since EL 2.2
+     */
+    @Override
+    public boolean isParametersProvided() {
+        return this.getNode().isParametersProvided();
+    }
+    
 }

Modified: tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java?rev=898969&r1=898968&r2=898969&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java Wed Jan 13 22:10:49 2010
@@ -31,6 +31,7 @@
 import javax.el.PropertyNotFoundException;
 import javax.el.PropertyNotWritableException;
 import javax.el.ValueExpression;
+import javax.el.ValueReference;
 import javax.el.VariableMapper;
 
 import org.apache.el.lang.ELSupport;
@@ -103,7 +104,7 @@
     private transient Node node;
 
     public ValueExpressionImpl() {
-
+        super();
     }
 
     /**
@@ -270,4 +271,15 @@
     public String toString() {
         return "ValueExpression["+this.expr+"]";
     }
+
+    /**
+     * @since EL 2.2
+     */
+    @Override
+    public ValueReference getValueReference(ELContext context) {
+        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
+                this.varMapper);
+        return this.getNode().getValueReference(ctx);
+    }
+    
 }

Modified: tomcat/trunk/java/org/apache/el/parser/AstValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstValue.java?rev=898969&r1=898968&r2=898969&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/AstValue.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstValue.java Wed Jan 13 22:10:49 2010
@@ -26,6 +26,7 @@
 import javax.el.ELResolver;
 import javax.el.MethodInfo;
 import javax.el.PropertyNotFoundException;
+import javax.el.ValueReference;
 
 import org.apache.el.lang.ELSupport;
 import org.apache.el.lang.EvaluationContext;
@@ -207,4 +208,20 @@
         }
         return result;
     }
+
+    /**
+     * @since EL 2.2
+     */
+    @Override
+    public ValueReference getValueReference(EvaluationContext ctx) {
+        // Check this is a reference to a base and a property
+        if (this.children.length > 2 && this.jjtGetChild(2) instanceof Suffix) {
+            // This is a method call
+            return null;
+        }
+        Target t = getTarget(ctx);
+        return new ValueReference(t.base, this.jjtGetChild(1).getValue(ctx));
+    }
+    
+    
 }

Modified: tomcat/trunk/java/org/apache/el/parser/Node.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/Node.java?rev=898969&r1=898968&r2=898969&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/Node.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/Node.java Wed Jan 13 22:10:49 2010
@@ -21,6 +21,7 @@
 
 import javax.el.ELException;
 import javax.el.MethodInfo;
+import javax.el.ValueReference;
 
 import org.apache.el.lang.EvaluationContext;
 
@@ -31,7 +32,7 @@
 
 /**
  * @author Jacob Hookom [jacob@hookom.net]
- * @version $Change: 181177 $$Date$$Author$
+ * $Id$
  */
 public interface Node {
 
@@ -63,9 +64,21 @@
   
   public Object getValue(EvaluationContext ctx) throws ELException;
   public void setValue(EvaluationContext ctx, Object value) throws ELException;
-  public Class getType(EvaluationContext ctx) throws ELException;
+  public Class<?> getType(EvaluationContext ctx) throws ELException;
   public boolean isReadOnly(EvaluationContext ctx) throws ELException;
   public void accept(NodeVisitor visitor) throws Exception;
-  public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes) throws ELException;
-  public Object invoke(EvaluationContext ctx, Class[] paramTypes, Object[] paramValues) throws ELException;
+  public MethodInfo getMethodInfo(EvaluationContext ctx, Class<?>[] paramTypes)
+          throws ELException;
+  public Object invoke(EvaluationContext ctx, Class<?>[] paramTypes,
+          Object[] paramValues) throws ELException;
+  
+  /**
+   * @since EL 2.2
+   */
+  public ValueReference getValueReference(EvaluationContext ctx);
+  
+  /**
+   * @since EL 2.2
+   */
+  public boolean isParametersProvided();
 }

Modified: tomcat/trunk/java/org/apache/el/parser/SimpleNode.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/SimpleNode.java?rev=898969&r1=898968&r2=898969&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/SimpleNode.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/SimpleNode.java Wed Jan 13 22:10:49 2010
@@ -21,6 +21,7 @@
 import javax.el.ELException;
 import javax.el.MethodInfo;
 import javax.el.PropertyNotWritableException;
+import javax.el.ValueReference;
 
 import org.apache.el.lang.ELSupport;
 import org.apache.el.lang.EvaluationContext;
@@ -153,17 +154,27 @@
         }
     }
 
-    // Interface el.parser.Node uses raw types (and is auto-generated)
-    public Object invoke(EvaluationContext ctx, 
-            @SuppressWarnings("unchecked") Class[] paramTypes,
+    public Object invoke(EvaluationContext ctx, Class<?>[] paramTypes,
             Object[] paramValues) throws ELException {
         throw new UnsupportedOperationException();
     }
 
-    // Interface el.parser.Node uses a raw type (and is auto-generated)
     public MethodInfo getMethodInfo(EvaluationContext ctx,
-            @SuppressWarnings("unchecked") Class[] paramTypes)
-            throws ELException {
+            Class<?>[] paramTypes) throws ELException {
         throw new UnsupportedOperationException();
     }
+    
+    /**
+     * @since EL 2.2
+     */
+    public ValueReference getValueReference(EvaluationContext ctx) {
+        return null;
+    }
+    
+    /**
+     * @since EL 2.2
+     */
+    public boolean isParametersProvided() {
+        return false;
+    }
 }



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