private static void invalidateComputedOGNLExpression( final IEngineConfiguration configuration, final IStandardVariableExpression expression, final String exp) { if (expression instanceof VariableExpression) { final VariableExpression vexpression = (VariableExpression) expression; vexpression.setCachedExpression(null); } else if (expression instanceof SelectionVariableExpression) { final SelectionVariableExpression vexpression = (SelectionVariableExpression) expression; vexpression.setCachedExpression(null); } ExpressionCache.removeFromCache(configuration, exp, EXPRESSION_CACHE_TYPE_OGNL); }
@Override public String toString() { return (isExpression()? "[" + this.expression.getStringRepresentation() + "]" : this.input); }
public static ExpressionParsingState decompose(final String input) { // Just before starting decomposing simple expressions, we perform the processing of literal substitutions... final ExpressionParsingState state = decomposeSimpleExpressions(LiteralSubstitutionUtil.performLiteralSubstitution(input)); return decomposeNestingParenthesis(state, 0); }
@Override protected boolean isVisible( final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue) { final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(context.getConfiguration()); final IStandardExpression expression = expressionParser.parseExpression(context, attributeValue); final Object value = expression.execute(context); return !EvaluationUtils.evaluateAsBoolean(value); }
private static AssignationSequence createSyntheticallyNamedParameterSequence(final ExpressionSequence expSeq) { final List<Assignation> assignations = new ArrayList<Assignation>(expSeq.size() + 2); int argIndex = 0; for (final IStandardExpression expression : expSeq.getExpressions()) { final IStandardExpression parameterName = Expression.parse(TextLiteralExpression.wrapStringIntoLiteral(UNNAMED_PARAMETERS_PREFIX + argIndex++)); assignations.add(new Assignation(parameterName, expression)); } return new AssignationSequence(assignations); }
public Object convert(final Object target, final Class<?> clazz) { final IStandardConversionService conversionService = StandardExpressions.getConversionService(this.context.getConfiguration()); return conversionService.convert(this.context, target, clazz); }
public boolean hasExpressionAt(final int pos) { return this.size() > pos && this.get(pos).isExpression(); }
private static Expression parseDefaultAsLiteral(final String input) { if (StringUtils.isEmptyOrWhitespace(input)) { return null; } final Expression expr = Expression.parse(input); if (expr == null) { return Expression.parse(TextLiteralExpression.wrapStringIntoLiteral(input)); } return expr; }
private static ComputedOGNLExpression parseComputedOGNLExpression( final IEngineConfiguration configuration, final String exp, final boolean applyOGNLShortcuts) throws OgnlException { ComputedOGNLExpression parsedExpression = (ComputedOGNLExpression) ExpressionCache.getFromCache(configuration, exp, EXPRESSION_CACHE_TYPE_OGNL); if (parsedExpression != null) { return parsedExpression; } // The result of parsing might be an OGNL expression AST or a ShortcutOGNLExpression (for simple cases) parsedExpression = parseExpression(exp, applyOGNLShortcuts); ExpressionCache.putIntoCache(configuration, exp, parsedExpression, EXPRESSION_CACHE_TYPE_OGNL); return parsedExpression; }
static ExpressionParsingState composeMultiplicationDivisionRemainderExpression( final ExpressionParsingState state, final int nodeIndex) { return composeBinaryOperationExpression( state, nodeIndex, OPERATORS, LENIENCIES, OPERATOR_CLASSES, LEFT_ALLOWED_METHOD, RIGHT_ALLOWED_METHOD); }
static ExpressionParsingState composeAdditionSubtractionExpression( final ExpressionParsingState state, final int nodeIndex) { return composeBinaryOperationExpression( state, nodeIndex, OPERATORS, LENIENCIES, OPERATOR_CLASSES, LEFT_ALLOWED_METHOD, RIGHT_ALLOWED_METHOD); }
static ExpressionParsingState composeAndExpression( final ExpressionParsingState state, final int nodeIndex) { return composeBinaryOperationExpression( state, nodeIndex, OPERATORS, LENIENCIES, OPERATOR_CLASSES, LEFT_ALLOWED_METHOD, RIGHT_ALLOWED_METHOD); }
protected static ExpressionParsingState composeEqualsNotEqualsExpression( final ExpressionParsingState state, final int nodeIndex) { return composeBinaryOperationExpression( state, nodeIndex, OPERATORS, LENIENCIES, OPERATOR_CLASSES, LEFT_ALLOWED_METHOD, RIGHT_ALLOWED_METHOD); }
public static Object unwrap(final Object obj) { if (obj == null) { return null; } if (obj instanceof LiteralValue) { return ((LiteralValue)obj).getValue(); } return obj; }
protected static ExpressionParsingState composeGreaterLesserExpression( final ExpressionParsingState state, final int nodeIndex) { return composeBinaryOperationExpression( state, nodeIndex, OPERATORS, LENIENCIES, OPERATOR_CLASSES, LEFT_ALLOWED_METHOD, RIGHT_ALLOWED_METHOD); }
public IExpressionObjectFactory getExpressionObjectFactory() { if (this.expressionObjectFactory == null) { this.expressionObjectFactory = new StandardExpressionObjectFactory(); } return this.expressionObjectFactory; }
public static Object wrapRequestObject(final Object obj) { if (obj == null || !(obj instanceof HttpServletRequest)) { return obj; } return new RestrictedRequestWrapper((HttpServletRequest)obj); }
public static ExecutedFragmentExpression createExecutedFragmentExpression( final IExpressionContext context, final FragmentExpression expression) { // All FragmentExpressions will be executed as RESTRICTED (no URL parameters allowed) return doCreateExecutedFragmentExpression(context, expression, StandardExpressionExecutionContext.RESTRICTED); }
private static Expression parseBaseDefaultAsLiteral(final String base) { if (StringUtils.isEmptyOrWhitespace(base)) { return null; } final Expression expr = Expression.parse(base); if (expr == null) { return Expression.parse(TextLiteralExpression.wrapStringIntoLiteral(base)); } return expr; }