1 17 18 package org.apache.el.lang; 19 20 import javax.el.ValueExpression; 21 import javax.el.VariableMapper; 22 23 public class VariableMapperFactory extends VariableMapper { 24 25 private final VariableMapper target; 26 private VariableMapper momento; 27 28 public VariableMapperFactory(VariableMapper target) { 29 if (target == null) { 30 throw new NullPointerException ("Target VariableMapper cannot be null"); 31 } 32 this.target = target; 33 } 34 35 public VariableMapper create() { 36 return this.momento; 37 } 38 39 public ValueExpression resolveVariable(String variable) { 40 ValueExpression expr = this.target.resolveVariable(variable); 41 if (expr != null) { 42 if (this.momento == null) { 43 this.momento = new VariableMapperImpl(); 44 } 45 this.momento.setVariable(variable, expr); 46 } 47 return expr; 48 } 49 50 public ValueExpression setVariable(String variable, ValueExpression expression) { 51 throw new UnsupportedOperationException ("Cannot Set Variables on Factory"); 52 } 53 } 54 | Popular Tags |