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.xml.transformer
Class JXPathExtractor

    java.lang.Object
      org.mule.transformer.AbstractTransformer
          org.mule.module.xml.transformer.JXPathExtractor

All Implemented Interfaces:
  MuleContextAware, MuleContextNotificationListener<MuleContextNotification>, ServerNotificationListener<MuleContextNotification>, Disposable, Initialisable, NamedObject, MessageProcessor, Transformer, EndpointAware

    public class JXPathExtractor

extends AbstractTransformer

The JXPathExtractor is a simple transformer that evaluates an xpath expression against the given bean and that returns the result.

By default, a single result will be returned. If multiple values are expected, set the `singleResult` property to `false`. In this case a `List` of values will be returned. Note the property is currently ignored for non-String/XML payloads.

Field Summary
`static String` | `OUTPUT_TYPE_NODE`
`static String` | `OUTPUT_TYPE_VALUE`
`static String` | `OUTPUT_TYPE_XML`

Fields inherited from class org.mule.transformer.AbstractTransformer
`encoding, endpoint, logger, mimeType, MULE_MESSAGE_DATA_TYPE, muleContext, name, returnType, sourceTypes`

Fields inherited from interface org.mule.api.lifecycle.Initialisable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`JXPathExtractor()`

Method Summary
`Object` | `doTransform(Object src, String encoding)` Evaluate the expression in the context of the given object and returns the result.
`String` | `getExpression()`
`Map` | `getNamespaces()`
`String` | `getOutputType()`
`void` | `initialise()` Template method where deriving classes can do any initialisation after the properties have been set on this transformer
`boolean` | `isSingleResult()` Should a single value be returned.
`void` | `setExpression(String expression)`
`void` | `setMuleContext(MuleContext context)`
`void` | `setNamespaces(Map namespaceURIs)`
`void` | `setOutputType(String outputEncoding)`
`void` | `setSingleResult(boolean singleResult)` If multiple results are expected from the `expression` evaluation, set this to false.

Methods inherited from class org.mule.transformer.AbstractTransformer
`checkReturnClass, dispose, generateTransformerName, getEncoding, getEncoding, getEndpoint, getMimeType, getName, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, isAcceptNull, isAllowNullReturn, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, onNotification, process, registerSourceType, registerSourceType, setAllowNullReturn, setEncoding, setEndpoint, setIgnoreBadInput, setMimeType, setName, setReturnClass, setReturnDataType, toString, transform, transform, unregisterSourceType, unregisterSourceType`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### OUTPUT_TYPE_NODE

    public static final String OUTPUT_TYPE_NODE

See Also:
  Constant Field Values

### OUTPUT_TYPE_XML

    public static final String OUTPUT_TYPE_XML

See Also:
  Constant Field Values

### OUTPUT_TYPE_VALUE

    public static final String OUTPUT_TYPE_VALUE

See Also:
  Constant Field Values

Constructor Detail

### JXPathExtractor

    public JXPathExtractor()

Method Detail

### setMuleContext

    public void setMuleContext(MuleContext context)

  Specified by:
    `setMuleContext` in interface `MuleContextAware`
  Overrides:
    `setMuleContext` in class `AbstractTransformer`

### initialise

    public void initialise()
                    throws InitialisationException

  Template method where deriving classes can do any initialisation after the properties have been set on this transformer

  Specified by:
    `initialise` in interface `Initialisable`
  Overrides:
    `initialise` in class `AbstractTransformer`
  Throws:
    `InitialisationException`
    `RecoverableException` - if an error occurs that can be recovered from

### doTransform

    public Object doTransform(Object src,
                              String encoding)
                       throws TransformerException

  Evaluate the expression in the context of the given object and returns the result. If the given object is a string, it assumes it is an valid xml and parses it before evaluating the xpath expression.

  Specified by:
    `doTransform` in class `AbstractTransformer`
  Throws:
    `TransformerException`

### getExpression

    public String getExpression()

  Returns:
    Returns the expression.

### setExpression

    public void setExpression(String expression)

  Parameters:
    `expression` - The expression to set.

### isSingleResult

    public boolean isSingleResult()

  Should a single value be returned.

  Returns:
    value

### setSingleResult

    public void setSingleResult(boolean singleResult)

  If multiple results are expected from the `expression` evaluation, set this to false.

  Parameters:
    `singleResult` - flag

### getOutputType

    public String getOutputType()

### setOutputType

    public void setOutputType(String outputEncoding)

### getNamespaces

    public Map getNamespaces()

### setNamespaces

    public void setNamespaces(Map namespaceURIs)

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.