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
-
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 String
getComponentType()
Subclasses may implement this method to provide component type information.IntegrationPatternType
getIntegrationPatternType()
Return a pattern type this component implements.void
onInit()
Subclasses may implement this for initialization logic.void
setDefaultOverwrite(boolean defaultOverwrite)
<T> void
setMessageProcessor(MessageProcessor<T> messageProcessor)
void
setShouldSkipNulls(boolean shouldSkipNulls)
Specify whethernull
values, 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 whethernull
values, such as might be returned from an expression evaluation, should be skipped. The default value istrue
. Set this tofalse
if anull
value should trigger removal of the corresponding header instead.- Parameters:
shouldSkipNulls
- true when null values should be skipped.
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classIntegrationObjectSupport
-
getIntegrationPatternType
Description copied from interface:IntegrationPattern
Return a pattern type this component implements.- Specified by:
getIntegrationPatternType
in interfaceIntegrationPattern
- Returns:
- the
IntegrationPatternType
this component implements.
-
onInit
public void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classIntegrationObjectSupport
-
transform
- Specified by:
transform
in interfaceGenericTransformer<Message<?>,Message<?>>
- Specified by:
transform
in interfaceTransformer
-