org.apache.commons.jexl

Interface Expression

public interface Expression

Represents a single JEXL expression. This simple interface provides access to the underlying expression through getExpression(), and it provides hooks to add a pre- and post- expression resolver.

An expression is different than a script - it is simply a reference of an expression.

Since: 1.0

Version: $Id: Expression.java 397092 2006-04-26 05:11:28Z dion $

Method Summary
voidaddPostResolver(JexlExprResolver resolver)
Allows addition of a resolver to allow custom interdiction of expression evaluation.
voidaddPreResolver(JexlExprResolver resolver)
Allows addition of a resolver to allow custom interdiction of expression evaluation.
Objectevaluate(JexlContext context)
Evaluates the expression with the variables contained in the supplied JexlContext.
StringgetExpression()
Returns the JEXL expression this Expression was created with.

Method Detail

addPostResolver

public void addPostResolver(JexlExprResolver resolver)
Allows addition of a resolver to allow custom interdiction of expression evaluation.

Parameters: resolver resolver to be called if Jexl expression evaluated to null.

addPreResolver

public void addPreResolver(JexlExprResolver resolver)
Allows addition of a resolver to allow custom interdiction of expression evaluation.

Parameters: resolver resolver to be called before Jexl expression evaluated

evaluate

public Object evaluate(JexlContext context)
Evaluates the expression with the variables contained in the supplied JexlContext.

Parameters: context A JexlContext containing variables.

Returns: The result of this evaluation

Throws: Exception on any error

getExpression

public String getExpression()
Returns the JEXL expression this Expression was created with.

Returns: The JEXL expression to be evaluated

Copyright © 2003-2010 The Apache Software Foundation. All Rights Reserved.