1 16 package org.apache.commons.jxpath.ri.compiler; 17 18 import org.apache.commons.jxpath.ri.QName; 19 import org.apache.commons.jxpath.ri.EvalContext; 20 21 27 public class VariableReference extends Expression { 28 29 private QName varName; 30 31 public VariableReference(QName varName) { 32 this.varName = varName; 33 } 34 35 public QName getVariableName() { 36 return varName; 37 } 38 39 public String toString() { 40 return "$" + varName; 41 } 42 43 public boolean isContextDependent() { 44 return false; 45 } 46 47 public boolean computeContextDependent() { 48 return false; 49 } 50 51 public Object compute(EvalContext context) { 52 return computeValue(context); 53 } 54 55 58 public Object computeValue(EvalContext context) { 59 return context.getRootContext().getVariableContext(varName); 60 } 61 } | Popular Tags |