Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.module.json
Class JsonExpressionEvaluator

    java.lang.Object
      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
`void` | `setName(String name)` Sets 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)

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.