org.mule.module.json
Class JsonExpressionEvaluator

java.lang.Object
  extended by org.mule.module.json.JsonExpressionEvaluator
All Implemented Interfaces:
ExpressionEvaluator, NamedObject
Direct Known Subclasses:
JsonNodeExpressionEvaluator

public class JsonExpressionEvaluator
extends Object
implements ExpressionEvaluator

An expression evaluator to allow users to define json expressions in their mule configuration, i.e. #[json:person/addresses[0]/postcode]

See the JsonData object for mor information about the query syntax.

It is also possible to use this evaluator in ExpressionFilter objects. For example a filter could be defined as -

#[json:person/registered]

Where 'registered' is a boolean value. It is also possible to filter on the existence of a value i.e.

#[json:person/favouriteColour]

Which would return true if 'favouriteColour' has been set. This evaluator also dds two logic operators you can use to create more sophisticated boolean expressions; equals and not equals -

#[json:person/favouriteColour = red]

or

#[json:person/favouriteColour != brown]

See Also:
JsonData

Field Summary
protected  Log logger
          logger used by this class
 
Constructor Summary
JsonExpressionEvaluator()
           
 
Method Summary
 Object evaluate(String expression, MuleMessage message)
          Extracts a single property from the message
protected  Object extractResultFromNode(org.codehaus.jackson.JsonNode result)
           
 String getName()
          Gets the name of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
logger used by this class

Constructor Detail

JsonExpressionEvaluator

public JsonExpressionEvaluator()
Method Detail

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 expression
message - the message to extract from
Returns:
the result of the extraction or null if the property was not found

extractResultFromNode

protected Object extractResultFromNode(org.codehaus.jackson.JsonNode result)

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-2012 MuleSoft, Inc.. All Rights Reserved.