org.mule.expression
Class MuleExpressionEvaluator
java.lang.Object
org.mule.expression.MuleExpressionEvaluator
- All Implemented Interfaces:
- MuleContextAware, ExpressionEvaluator, NamedObject
public class MuleExpressionEvaluator
- extends Object
- implements ExpressionEvaluator, MuleContextAware
This evaluator provide a powerful expression language for querying mule information
at runtime. It provides a unified language for querying message properties, attachments
payload, Mule context information such as the current service or endpoint and access to
the registry. Here are some examples:
#[mule:message.headers(foo, bar)] - retrieves two headers 'foo' and 'bar' and returns a Map.
#[mule:message.attachments-list(attach1, attach2*)] - retrieves two named attachments in a List. The star on 'attach2'
indicates that it is optional
#[mule:message.headers(all)] - retrieves all headers and returns as a Map.
#[mule:message.payload(org.dom4j.Document)] - return the payload and convert it to a org.dom4j.Document.
#[mule:message.correlationId] - return the the correlationId on the message
#[mule:message.map-payload(foo)] - expects a Map payload object and will retrive a property 'foo' from the map.
#[mule.context.serviceName] - returns the current service Name
#[mule.context.modelName] - returns the current model Name
#[mule.context.workingDir] - returns the working Directory
#[mule.context.serverId] - returns the current server ID
#[mule.registry.apple] - returns an object called 'apple' from the registry
#[mule.registry.apple*] - returns an object called 'apple' from the registry but is optional
#[mule.registry.apple.washed] - returns the property 'washed on an object called 'apple' in the registry
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME
public static final String NAME
- See Also:
- Constant Field Values
MuleExpressionEvaluator
public MuleExpressionEvaluator()
setMuleContext
public void setMuleContext(MuleContext context)
- Specified by:
setMuleContext
in interface MuleContextAware
evaluate
public Object evaluate(String expression,
MuleMessage message)
- Description copied from interface:
ExpressionEvaluator
- Extracts a single property from the message
- Specified by:
evaluate
in interface ExpressionEvaluator
- Parameters:
expression
- the property expression or expressionmessage
- the message to extract from
- Returns:
- the result of the extraction or null if the property was not found
getExpressionConfig
protected ExpressionConfig getExpressionConfig(String eval,
String expression)
setName
public void setName(String name)
- Description copied from interface:
NamedObject
- Sets the name of the object
- Specified by:
setName
in interface NamedObject
- Parameters:
name
- the name of the object
getName
public String getName()
- Description copied from interface:
NamedObject
- Gets the name of the object
- Specified by:
getName
in interface NamedObject
- Returns:
- the name of the object
Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.