public class XPathTransformer extends AbstractTransformer
XmlPayloadConverter
instance. The default converter type is DefaultXmlPayloadConverter.
The evaluation result type will depend on either the enumeration value provided to
setEvaluationType(XPathEvaluationType) or the presence of a NodeMapper,
which takes precedence. If no NodeMapper or evaluation type is configured explicitly,
the default evaluation type is XPathEvaluationType.STRING_RESULT.
EXPRESSION_PARSER, logger| Constructor and Description |
|---|
XPathTransformer(java.lang.String expression)
Create an
XPathTransformer that will create an XPath expression from the given String
to be evaluated against converted inbound Message payloads. |
XPathTransformer(org.springframework.xml.xpath.XPathExpression expression)
Create an
XPathTransformer that will evaluate the given XPathExpression
against converted inbound Message payloads. |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
doTransform(org.springframework.messaging.Message<?> message)
Subclasses must implement this method to provide the transformation
logic.
|
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
void |
setConverter(XmlPayloadConverter converter)
Specify the
XmlPayloadConverter to use when converting a Message payload prior to XPath evaluation. |
void |
setEvaluationType(XPathEvaluationType evaluationType)
Specify the expected
XPathEvaluationType. |
void |
setNodeMapper(org.springframework.xml.xpath.NodeMapper<?> nodeMapper)
Set a
NodeMapper to use for generating the result object. |
transformafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringpublic XPathTransformer(java.lang.String expression)
XPathTransformer that will create an XPath expression from the given String
to be evaluated against converted inbound Message payloads.expression - The expression.public XPathTransformer(org.springframework.xml.xpath.XPathExpression expression)
XPathTransformer that will evaluate the given XPathExpression
against converted inbound Message payloads.expression - The expression.public void setEvaluationType(XPathEvaluationType evaluationType)
XPathEvaluationType. The default is XPathEvaluationType.STRING_RESULT.evaluationType - The evaluation type.public void setNodeMapper(org.springframework.xml.xpath.NodeMapper<?> nodeMapper)
NodeMapper to use for generating the result object. By default the NodeMapper is null,
but if explicitly set, type determination is the responsibility of the NodeMapper, taking precedence
over any configured evaluationType.nodeMapper - The node mapper.public void setConverter(XmlPayloadConverter converter)
XmlPayloadConverter to use when converting a Message payload prior to XPath evaluation.converter - The payload converter.public java.lang.String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportprotected java.lang.Object doTransform(org.springframework.messaging.Message<?> message)
throws java.lang.Exception
AbstractTransformerdoTransform in class AbstractTransformermessage - The message.java.lang.Exception - Any exception.