org.apache.camel.model.language
Class ExpressionDefinition

java.lang.Object
  extended by org.apache.camel.model.language.ExpressionDefinition
All Implemented Interfaces:
Expression, Predicate
Direct Known Subclasses:
ConstantExpression, ELExpression, ExpressionClause, GroovyExpression, HeaderExpression, JavaScriptExpression, JXPathExpression, LanguageExpression, MethodCallExpression, MvelExpression, NamespaceAwareExpression, OgnlExpression, PhpExpression, PropertyExpression, PythonExpression, RubyExpression, SimpleExpression, SqlExpression, TokenizerExpression

public class ExpressionDefinition
extends Object
implements Expression, Predicate

A useful base class for an expression

Version:
$Revision: 19415 $

Constructor Summary
ExpressionDefinition()
           
ExpressionDefinition(Expression expression)
           
ExpressionDefinition(Predicate predicate)
           
ExpressionDefinition(String expression)
           
 
Method Summary
 void assertMatches(String text, Exchange exchange)
           
protected  void configureExpression(CamelContext camelContext, Expression expression)
           
protected  void configurePredicate(CamelContext camelContext, Predicate predicate)
           
 Expression createExpression(CamelContext camelContext)
           
 Expression createExpression(RouteContext routeContext)
           
 Predicate createPredicate(CamelContext camelContext)
           
 Predicate createPredicate(RouteContext routeContext)
           
 Object evaluate(Exchange exchange)
           
<T> T
evaluate(Exchange exchange, Class<T> type)
          Returns the value of the expression on the given exchange
 String getExpression()
           
 ExpressionDefinition getExpressionType()
           
 Expression getExpressionValue()
           
 String getId()
          Gets the value of the id property.
 String getLabel()
          Returns some descriptive text to describe this node
static String getLabel(List<ExpressionDefinition> expressions)
           
 String getLanguage()
           
 Predicate getPredicate()
           
 boolean matches(Exchange exchange)
          Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate
 void setExpression(String expression)
           
protected  void setExpressionType(ExpressionDefinition expressionType)
          Allows derived classes to set a lazily created expressionType instance such as if using the ExpressionClause
protected  void setExpressionValue(Expression expressionValue)
           
 void setId(String value)
          Sets the value of the id property.
protected  void setProperty(Object bean, String name, Object value)
          Sets a named property on the object instance using introspection
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionDefinition

public ExpressionDefinition()

ExpressionDefinition

public ExpressionDefinition(String expression)

ExpressionDefinition

public ExpressionDefinition(Predicate predicate)

ExpressionDefinition

public ExpressionDefinition(Expression expression)
Method Detail

getLabel

public static String getLabel(List<ExpressionDefinition> expressions)

toString

public String toString()
Overrides:
toString in class Object

evaluate

public Object evaluate(Exchange exchange)

evaluate

public <T> T evaluate(Exchange exchange,
                      Class<T> type)
Description copied from interface: Expression
Returns the value of the expression on the given exchange

Specified by:
evaluate in interface Expression
Parameters:
exchange - the message exchange on which to evaluate the expression
type - the expected type of the evaluation result
Returns:
the value of the expression

assertMatches

public void assertMatches(String text,
                          Exchange exchange)
                   throws AssertionError
Throws:
AssertionError

matches

public boolean matches(Exchange exchange)
Description copied from interface: Predicate
Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate

Specified by:
matches in interface Predicate
Parameters:
exchange - the message exchange
Returns:
true if the predicate matches

getLanguage

public String getLanguage()

createPredicate

public final Predicate createPredicate(RouteContext routeContext)

createPredicate

public Predicate createPredicate(CamelContext camelContext)

createExpression

public final Expression createExpression(RouteContext routeContext)

createExpression

public Expression createExpression(CamelContext camelContext)

getExpression

public String getExpression()

setExpression

public void setExpression(String expression)

getId

public String getId()
Gets the value of the id property.


setId

public void setId(String value)
Sets the value of the id property.


getPredicate

public Predicate getPredicate()

getExpressionValue

public Expression getExpressionValue()

setExpressionValue

protected void setExpressionValue(Expression expressionValue)

getExpressionType

public ExpressionDefinition getExpressionType()

getLabel

public String getLabel()
Returns some descriptive text to describe this node


setExpressionType

protected void setExpressionType(ExpressionDefinition expressionType)
Allows derived classes to set a lazily created expressionType instance such as if using the ExpressionClause


configurePredicate

protected void configurePredicate(CamelContext camelContext,
                                  Predicate predicate)

configureExpression

protected void configureExpression(CamelContext camelContext,
                                   Expression expression)

setProperty

protected void setProperty(Object bean,
                           String name,
                           Object value)
Sets a named property on the object instance using introspection



Apache CAMEL