List of usage examples for org.apache.commons.jxpath Variables getVariable
Object getVariable(String varName);
From source file:org.chiba.xml.xforms.xpath.CoreExtensionFunctions.java
/** * Undeclares the specified variable an returns its value. * * @param expressionContext the expression context. * @param name the name of the variable. * @return the value of the variable./*from w w w . j av a2s. co m*/ */ public static Object undeclare(ExpressionContext expressionContext, String name) { Variables variables = expressionContext.getJXPathContext().getVariables(); Object value = variables.getVariable(name); variables.undeclareVariable(name); return value; }
From source file:org.openvpms.archetype.function.expression.ExpressionFunctions.java
/** * Evaluates a variable, if it exists.//from w w w . ja va2 s . co m * * @param context the expression context * @param name the variable name * @return the value of the variable, or {@code elseValue} if it doesn't exist */ public Object var(ExpressionContext context, String name, Object elseValue) { Variables variables = context.getJXPathContext().getVariables(); if (variables.isDeclaredVariable(name)) { return variables.getVariable(name); } return elseValue; }