List of usage examples for org.apache.commons.jxpath Variables isDeclaredVariable
boolean isDeclaredVariable(String varName);
From source file:org.openvpms.archetype.function.expression.ExpressionFunctions.java
/** * Evaluates a variable, if it exists.//w w w . j a v a 2s. c o 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; }