use of org.openforis.idm.model.expression.internal.ModelJXPathCompiledExpression in project collect by openforis.
the class ExpressionFactory method createValueExpression.
public ValueExpression createValueExpression(String expression) throws InvalidExpressionException {
ModelJXPathCompiledExpression compiledExpression = compileExpression(expression);
ValueExpression expr = new ValueExpression(compiledExpression, jxPathContext);
return expr;
}
use of org.openforis.idm.model.expression.internal.ModelJXPathCompiledExpression in project collect by openforis.
the class ExpressionFactory method createModelPathExpression.
public ModelPathExpression createModelPathExpression(String expression) throws InvalidExpressionException {
ModelJXPathCompiledExpression compiledExpression = compileExpression(expression);
ModelPathExpression expr = new ModelPathExpression(compiledExpression, jxPathContext);
return expr;
}
use of org.openforis.idm.model.expression.internal.ModelJXPathCompiledExpression in project collect by openforis.
the class ExpressionFactory method createBooleanExpression.
public BooleanExpression createBooleanExpression(String expression, boolean normalizeNumbers) throws InvalidExpressionException {
ModelJXPathCompiledExpression compiledExpression = compileExpression(expression, normalizeNumbers);
BooleanExpression expr = new BooleanExpression(compiledExpression, jxPathContext);
return expr;
}
use of org.openforis.idm.model.expression.internal.ModelJXPathCompiledExpression in project collect by openforis.
the class ExpressionFactory method createAbsoluteModelPathExpression.
public AbsoluteModelPathExpression createAbsoluteModelPathExpression(String expression) throws InvalidExpressionException {
if (!expression.startsWith(String.valueOf(Path.SEPARATOR))) {
throw new InvalidExpressionException("Absolute paths must start with '/'");
}
int pos = expression.indexOf(Path.SEPARATOR, 1);
if (pos < 0) {
String root = expression.substring(1);
return new AbsoluteModelPathExpression(root);
} else {
String root = expression.substring(1, pos);
expression = expression.substring(pos + 1);
ModelJXPathCompiledExpression compiledExpression = compileExpression(expression);
return new AbsoluteModelPathExpression(root, compiledExpression, jxPathContext);
}
}
use of org.openforis.idm.model.expression.internal.ModelJXPathCompiledExpression in project collect by openforis.
the class ExpressionFactory method compileExpression.
private ModelJXPathCompiledExpression compileExpression(String expression, boolean normalizeNumber) throws InvalidExpressionException {
ExpressionKey key = new ExpressionKey(expression, normalizeNumber);
ModelJXPathCompiledExpression compiled = COMPILED_EXPRESSIONS.get(key);
if (compiled == null) {
try {
String normalizedExpression = Path.getNormalizedPath(expression);
compiled = ModelJXPathContext.compile(this, normalizedExpression, normalizeNumber);
COMPILED_EXPRESSIONS.put(key, compiled);
} catch (JXPathInvalidSyntaxException e) {
throw new InvalidExpressionException(e.getMessage());
}
}
return compiled;
}
Aggregations