package org.jboss.loom.utils.el;

import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

/**
 *  Delegates the variable resolving to an IVariablesProvider provided to the constructor.
 *  Read-only.
 */
public class ProvidedVariableJuelMapper extends javax.el.VariableMapper {
    private static final ExpressionFactory JUEL_FACTORY = new de.odysseus.el.ExpressionFactoryImpl();
    

    private final IExprLangEvaluator.IVariablesProvider<Object> provider;

    
    public ProvidedVariableJuelMapper( IExprLangEvaluator.IVariablesProvider<Object> provider ) {
        this.provider = provider;
    }
    

    @Override public ValueExpression resolveVariable( String variable ) {
        return JUEL_FACTORY.createValueExpression( this.provider.getVariable( variable ), Object.class );
    }
    
    @Override public ValueExpression setVariable( String variable, ValueExpression expression ) {
        throw new UnsupportedOperationException( "Read-only, can't set: " + variable );
    }
    
}// class
@@ -684,17 +684,81 @@
  var
-iable ) %7B
+Name ) %7B%0A        final Object var = this.provider.getVariable( varName );
 %0A   
@@ -809,45 +809,11 @@
 on( 
-this.provider.getVariable( variable )
+var
 , Ob

Introduce variable (for debugging)