incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r504720 - /incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
Date Wed, 07 Feb 2007 22:18:27 GMT
Author: awiner
Date: Wed Feb  7 14:18:26 2007
New Revision: 504720

URL: http://svn.apache.org/viewvc?view=rev&rev=504720
Log:
ADFFACES-375:  Require a test implementation for MethodExpression
Mostly from patch by Pavitra Subramaniam
- In JSF 1.2 branch, implement MApplication.getExpressionFactory().createMethodExpression().
  The target MethodExpression will throw an exception if you try to invoke it;  this
  is here for renderers that may set up components during encoding for later decode
  processign.

Modified:
    incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java

Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java?view=diff&rev=504720&r1=504719&r2=504720
==============================================================================
--- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
(original)
+++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
Wed Feb  7 14:18:26 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.myfaces.trinidadinternal.renderkit;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -27,6 +28,7 @@
 import javax.el.ExpressionFactory;
 import javax.el.ELContext;
 import javax.el.MethodExpression;
+import javax.el.MethodInfo;
 import javax.el.ValueExpression;
 
 import javax.faces.FacesException;
@@ -374,7 +376,7 @@
       Class<?> expectedReturnType,
       Class<?>[] expectedParamTypes) 
     {
-      throw new UnsupportedOperationException("Not implemented yet");
+      return new NotSupportedMethodExpression(expression);
     }
 
     public ValueExpression createValueExpression(
@@ -386,12 +388,65 @@
     }
     
     
-    public ValueExpression createValueExpression(Object instance, Class<?> expectedType)
+    public ValueExpression createValueExpression(
+      Object instance, Class<?> expectedType)
     {
       throw new UnsupportedOperationException("Not implemented yet");
     }
   };
     
+  /**
+   * A very rudimentary implementation, to support
+   * renderers that might create (but not evaluate) MethodExpressions
+   */
+  private class NotSupportedMethodExpression extends MethodExpression
+    implements Serializable
+  {
+    public NotSupportedMethodExpression(String expression)
+    {
+      _expression = expression;
+    }
+
+    @Override
+    public MethodInfo getMethodInfo(ELContext elContext)
+    {
+      throw new UnsupportedOperationException("Not implemented yet");
+    }
+
+    @Override
+    public Object invoke(ELContext elContext, Object[] objects)
+    {
+      throw new UnsupportedOperationException("Not implemented yet");
+    }
+
+    @Override
+    public String getExpressionString()
+    {
+      return _expression;
+    }
+
+    @Override
+    public boolean isLiteralText()
+    {
+      return false;
+    }
+
+
+    @Override
+    public boolean equals(Object object)
+    {
+      return (object == this);
+    }
+
+    @Override
+    public int hashCode()
+    {
+      return System.identityHashCode(this);
+    }
+
+    private final String _expression;
+  }
+
   private Map<String, String> _components = new HashMap<String, String>();
   private ViewHandler _viewHandler = new MViewHandler();
   private VariableResolver _variableResolver = new MVariableResolver();



Mime
View raw message