Class HeaderEnricher
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.HeaderEnricher
- All Implemented Interfaces:
Aware,BeanFactoryAware,BeanNameAware,InitializingBean,ApplicationContextAware,ExpressionCapable,IntegrationPattern,NamedComponent,GenericTransformer<Message<?>,Message<?>>,Transformer
- Direct Known Subclasses:
XPathHeaderEnricher
public class HeaderEnricher extends IntegrationObjectSupport implements Transformer, IntegrationPattern
A Transformer that adds statically configured header values to a Message.
Accepts the boolean 'overwrite' property that specifies whether values should
be overwritten. By default, any existing header values for a given key, will
not be replaced.
- Author:
- Mark Fisher, David Turanski, Artem Bilan, Gary Russell, Trung Pham
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description HeaderEnricher()HeaderEnricher(Map<String,? extends HeaderValueMessageProcessor<?>> headersToAdd)Create a HeaderEnricher with the given map of headers. -
Method Summary
Modifier and Type Method Description StringgetComponentType()Subclasses may implement this method to provide component type information.IntegrationPatternTypegetIntegrationPatternType()Return a pattern type this component implements.voidonInit()Subclasses may implement this for initialization logic.voidsetDefaultOverwrite(boolean defaultOverwrite)<T> voidsetMessageProcessor(MessageProcessor<T> messageProcessor)voidsetShouldSkipNulls(boolean shouldSkipNulls)Specify whethernullvalues, such as might be returned from an expression evaluation, should be skipped.Message<?>transform(Message<?> message)Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Constructor Details
-
HeaderEnricher
public HeaderEnricher() -
HeaderEnricher
Create a HeaderEnricher with the given map of headers.- Parameters:
headersToAdd- The headers to add.
-
-
Method Details
-
setMessageProcessor
-
setDefaultOverwrite
public void setDefaultOverwrite(boolean defaultOverwrite) -
setShouldSkipNulls
public void setShouldSkipNulls(boolean shouldSkipNulls)Specify whethernullvalues, such as might be returned from an expression evaluation, should be skipped. The default value istrue. Set this tofalseif anullvalue should trigger removal of the corresponding header instead.- Parameters:
shouldSkipNulls- true when null values should be skipped.
-
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classIntegrationObjectSupport
-
getIntegrationPatternType
Description copied from interface:IntegrationPatternReturn a pattern type this component implements.- Specified by:
getIntegrationPatternTypein interfaceIntegrationPattern- Returns:
- the
IntegrationPatternTypethis component implements.
-
onInit
public void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classIntegrationObjectSupport
-
transform
- Specified by:
transformin interfaceGenericTransformer<Message<?>,Message<?>>- Specified by:
transformin interfaceTransformer
-