Class XPathTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.xml.transformer.XPathTransformer
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- InitializingBean,- ApplicationContextAware,- ExpressionCapable,- GenericTransformer<Message<?>,,- Message<?>> - NamedComponent,- Transformer
Transformer implementation that evaluates an XPath expression against the inbound
 Message payload and returns a Message whose payload is the result of that evaluation.
 Prior to evaluation, the payload may be converted by the configured 
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.
- Since:
- 2.0
- Author:
- Mark Fisher
- 
Field SummaryFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, logger
- 
Constructor SummaryConstructorsConstructorDescriptionXPathTransformer(String expression) Create anXPathTransformerthat will create an XPath expression from the given String to be evaluated against converted inbound Message payloads.XPathTransformer(XPathExpression expression) Create anXPathTransformerthat will evaluate the givenXPathExpressionagainst converted inbound Message payloads.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectdoTransform(Message<?> message) Subclasses must implement this method to provide the transformation logic.Subclasses may implement this method to provide component type information.voidsetConverter(XmlPayloadConverter converter) Specify theXmlPayloadConverterto use when converting a Message payload prior to XPath evaluation.voidsetEvaluationType(XPathEvaluationType evaluationType) Specify the expectedXPathEvaluationType.voidsetNodeMapper(NodeMapper<?> nodeMapper) Set aNodeMapperto use for generating the result object.Methods inherited from class org.springframework.integration.transformer.AbstractTransformertransformMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
- 
Constructor Details- 
XPathTransformerCreate anXPathTransformerthat will create an XPath expression from the given String to be evaluated against converted inbound Message payloads.- Parameters:
- expression- The expression.
 
- 
XPathTransformerCreate anXPathTransformerthat will evaluate the givenXPathExpressionagainst converted inbound Message payloads.- Parameters:
- expression- The expression.
 
 
- 
- 
Method Details- 
setEvaluationTypeSpecify the expectedXPathEvaluationType. The default isXPathEvaluationType.STRING_RESULT.- Parameters:
- evaluationType- The evaluation type.
 
- 
setNodeMapperSet aNodeMapperto 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.- Parameters:
- nodeMapper- The node mapper.
 
- 
setConverterSpecify theXmlPayloadConverterto use when converting a Message payload prior to XPath evaluation.- Parameters:
- converter- The payload converter.
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- IntegrationObjectSupport
 
- 
doTransformDescription copied from class:AbstractTransformerSubclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.- Specified by:
- doTransformin class- AbstractTransformer
- Parameters:
- message- The message.
- Returns:
- The result of the transformation.
 
 
-