org.apache.camel.model.language
Class ExpressionType

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

public class ExpressionType
extends Object
implements Expression<Exchange>, Predicate<Exchange>

A useful base class for an expression

Version:
$Revision: 1456 $

Constructor Summary
ExpressionType()
           
ExpressionType(Expression expression)
           
ExpressionType(Predicate predicate)
           
ExpressionType(String expression)
           
 
Method Summary
 void assertMatches(String text, Exchange exchange)
          Allows this predicate to be used nicely in testing to generate a nicely formatted exception and message if this predicate does not match for the given exchange.
protected  void configureExpression(RouteContext routeContext, Expression expression)
           
protected  void configurePredicate(RouteContext routeContext, Predicate predicate)
           
 Expression createExpression(RouteContext routeContext)
           
 Predicate<Exchange> createPredicate(RouteContext routeContext)
           
 Object evaluate(Exchange exchange)
          Returns the value of the expression on the given exchange
 String getExpression()
           
 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<ExpressionType> 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(ExpressionType 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

ExpressionType

public ExpressionType()

ExpressionType

public ExpressionType(String expression)

ExpressionType

public ExpressionType(Predicate predicate)

ExpressionType

public ExpressionType(Expression expression)
Method Detail

getLabel

public static String getLabel(List<ExpressionType> expressions)

toString

public String toString()
Overrides:
toString in class Object

evaluate

public Object evaluate(Exchange exchange)
Description copied from interface: Expression
Returns the value of the expression on the given exchange

Specified by:
evaluate in interface Expression<Exchange>
Parameters:
exchange - the message exchange on which to evaluate the expression
Returns:
the value of the expression

assertMatches

public void assertMatches(String text,
                          Exchange exchange)
                   throws AssertionError
Description copied from interface: Predicate
Allows this predicate to be used nicely in testing to generate a nicely formatted exception and message if this predicate does not match for the given exchange.

Specified by:
assertMatches in interface Predicate<Exchange>
Parameters:
text - the description to use in the exception message
exchange - the exchange to evaluate the expression on
Throws:
AssertionError - if the predicate does not match

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<Exchange>
Parameters:
exchange - the message exchange
Returns:
true if the predicate matches

getLanguage

public String getLanguage()

createPredicate

public Predicate<Exchange> createPredicate(RouteContext routeContext)

createExpression

public Expression createExpression(RouteContext routeContext)

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)

getLabel

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


setExpressionType

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


configurePredicate

protected void configurePredicate(RouteContext routeContext,
                                  Predicate predicate)

configureExpression

protected void configureExpression(RouteContext routeContext,
                                   Expression expression)

setProperty

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



Copyright © 2009 IONA Open Source Community. All Rights Reserved.