Class HeaderEnricher
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.HeaderEnricher
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,ExpressionCapable
,IntegrationPattern
,NamedComponent
,GenericTransformer<org.springframework.messaging.Message<?>,org.springframework.messaging.Message<?>>
,Transformer
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.
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description HeaderEnricher()
HeaderEnricher(java.util.Map<java.lang.String,? extends HeaderValueMessageProcessor<?>> headersToAdd)
Create a HeaderEnricher with the given map of headers. -
Method Summary
Modifier and Type Method Description java.lang.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.org.springframework.messaging.Message<?>
transform(org.springframework.messaging.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
public HeaderEnricher(java.util.Map<java.lang.String,? extends HeaderValueMessageProcessor<?>> headersToAdd)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
public java.lang.String 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
public org.springframework.messaging.Message<?> transform(org.springframework.messaging.Message<?> message)- Specified by:
transform
in interfaceGenericTransformer<org.springframework.messaging.Message<?>,org.springframework.messaging.Message<?>>
- Specified by:
transform
in interfaceTransformer
-