[jboss-cvs] jboss-seam/src/main/org/jboss/seam/jsf ...

Gavin King gavin.king at jboss.com
Fri Jun 1 16:05:14 EDT 2007


  User: gavin   
  Date: 07/06/01 16:05:14

  Modified:    src/main/org/jboss/seam/jsf    SeamApplication.java
  Added:       src/main/org/jboss/seam/jsf    UnifiedELMethodBinding.java
                        UnifiedELValueBinding.java
  Log:
  solve an issue with RI calls to itself
  
  Revision  Changes    Path
  1.15      +10 -12    jboss-seam/src/main/org/jboss/seam/jsf/SeamApplication.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SeamApplication.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/jsf/SeamApplication.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- SeamApplication.java	1 Jun 2007 19:47:12 -0000	1.14
  +++ SeamApplication.java	1 Jun 2007 20:05:14 -0000	1.15
  @@ -120,15 +120,6 @@
      }
   
      @Override
  -   public MethodBinding createMethodBinding(String expression, Class[] params)
  -         throws ReferenceSyntaxException
  -   {
  -      //TODO: proxy this, if we want JBoss EL to be usable     
  -      return application.createMethodBinding(expression, params);
  -
  -   }
  -
  -   @Override
      public Validator createValidator(String validatorId) throws FacesException
      {
         if ( Contexts.isApplicationContextActive() )
  @@ -143,11 +134,18 @@
      }
   
      @Override
  -   public ValueBinding createValueBinding(String ref)
  +   public MethodBinding createMethodBinding(String expression, Class[] params)
  +         throws ReferenceSyntaxException
  +   {
  +      return new UnifiedELMethodBinding(expression, params);
  +
  +   }
  +
  +   @Override
  +   public ValueBinding createValueBinding(String expression)
            throws ReferenceSyntaxException
      {
  -      //TODO: proxy this, if we want JBoss EL to be usable
  -      return application.createValueBinding(ref);
  +      return new UnifiedELValueBinding(expression);
      }
   
      @Override
  
  
  
  1.1      date: 2007/06/01 20:05:14;  author: gavin;  state: Exp;jboss-seam/src/main/org/jboss/seam/jsf/UnifiedELMethodBinding.java
  
  Index: UnifiedELMethodBinding.java
  ===================================================================
  package org.jboss.seam.jsf;
  
  import java.io.Serializable;
  
  import javax.el.MethodExpression;
  import javax.faces.context.FacesContext;
  import javax.faces.el.EvaluationException;
  import javax.faces.el.MethodBinding;
  import javax.faces.el.MethodNotFoundException;
  
  @SuppressWarnings("deprecation")
  @Deprecated
  public class UnifiedELMethodBinding extends MethodBinding implements Serializable
  {
     private transient MethodExpression methodExpression;
     
     private String expressionString;
     private Class[] argTypes;
  
     public UnifiedELMethodBinding() {}
     
     public UnifiedELMethodBinding(String expressionString, Class[] argTypes)
     {
        this.expressionString = expressionString;
        this.argTypes = argTypes;
     }
  
     @Override
     public String getExpressionString()
     {
        return expressionString;
     }
  
     @Override
     public Class getType(FacesContext ctx) throws MethodNotFoundException
     {
        return getMethodExpression(ctx).getMethodInfo( ctx.getELContext() ).getReturnType();
     }
  
     @Override
     public Object invoke(FacesContext ctx, Object[] args) throws EvaluationException, MethodNotFoundException
     {
        return getMethodExpression(ctx).invoke( ctx.getELContext(), args);
     }
  
     @Override
     public String toString()
     {
        return getExpressionString();
     }
  
     private MethodExpression getMethodExpression(FacesContext ctx)
     {
        if (methodExpression==null)
        {
           methodExpression = ctx.getApplication().getExpressionFactory()
                    .createMethodExpression( ctx.getELContext(), expressionString, Object.class, argTypes );
        }
        return methodExpression;
     }
  }
  
  
  1.1      date: 2007/06/01 20:05:14;  author: gavin;  state: Exp;jboss-seam/src/main/org/jboss/seam/jsf/UnifiedELValueBinding.java
  
  Index: UnifiedELValueBinding.java
  ===================================================================
  package org.jboss.seam.jsf;
  
  import java.io.Serializable;
  
  import javax.el.ValueExpression;
  import javax.faces.context.FacesContext;
  import javax.faces.el.EvaluationException;
  import javax.faces.el.PropertyNotFoundException;
  import javax.faces.el.ValueBinding;
  
  @SuppressWarnings("deprecation")
  @Deprecated
  public class UnifiedELValueBinding extends ValueBinding implements Serializable
  {
     private transient ValueExpression valueExpression;
     
     private String expressionString;
  
     public UnifiedELValueBinding(String expressionString)
     {
        this.expressionString = expressionString;
     }
  
     public UnifiedELValueBinding() {}
     
     @Override
     public String getExpressionString()
     {
        return expressionString;
     }
  
     @Override
     public Class getType(FacesContext ctx) throws EvaluationException, PropertyNotFoundException {
        return getValueExpression(ctx).getType( ctx.getELContext() );
     }
  
     @Override
     public Object getValue(FacesContext ctx) throws EvaluationException, PropertyNotFoundException {
     	return getValueExpression(ctx).getValue( ctx.getELContext() );
     }
  
     @Override
     public boolean isReadOnly(FacesContext ctx) throws EvaluationException, PropertyNotFoundException {
     	return getValueExpression(ctx).isReadOnly( ctx.getELContext() );
     }
  
     @Override
     public void setValue(FacesContext ctx, Object value) throws EvaluationException, PropertyNotFoundException {
        getValueExpression(ctx).setValue( ctx.getELContext(), value);
     }
     
     @Override
     public String toString()
     {
        return getExpressionString();
     }
  
     private ValueExpression getValueExpression(FacesContext ctx)
     {
        if (valueExpression==null)
        {
           valueExpression = ctx.getApplication().getExpressionFactory()
                    .createValueExpression( ctx.getELContext(), expressionString, Object.class );
        }
        return valueExpression;
     }
  }
  
  



More information about the jboss-cvs-commits mailing list