public abstract class IntegrationObjectSupport extends Object implements BeanNameAware, NamedComponent, ApplicationContextAware, BeanFactoryAware, InitializingBean, ExpressionCapable
TaskScheduler
and ConversionService
instances.
This is intended to be used as a base class for internal framework components whereas code built upon the integration framework should not require tight coupling with the context but rather rely on standard dependency injection.
Modifier and Type | Field and Description |
---|---|
protected static ExpressionParser |
EXPRESSION_PARSER |
protected Log |
logger
Logger that is available to subclasses
|
Constructor and Description |
---|
IntegrationObjectSupport() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected <T> T |
extractTypeIfPossible(Object targetObject,
Class<T> expectedType) |
protected ApplicationContext |
getApplicationContext() |
String |
getApplicationContextId()
Returns the
ApplicationContext.getId() if the
ApplicationContext is available. |
protected BeanFactory |
getBeanFactory() |
protected DestinationResolver<MessageChannel> |
getChannelResolver() |
String |
getComponentName()
Will return the name of this component identified by
componentName field. |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
ConversionService |
getConversionService() |
Expression |
getExpression()
Return the primary SpEL expression if this component is expression-based.
|
protected Properties |
getIntegrationProperties() |
protected <T> T |
getIntegrationProperty(String key,
Class<T> tClass) |
protected MessageBuilderFactory |
getMessageBuilderFactory() |
protected TaskScheduler |
getTaskScheduler() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setBeanName(String beanName) |
void |
setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
Specify the
DestinationResolver strategy to use. |
void |
setComponentName(String componentName)
Sets the name of this component.
|
protected void |
setConversionService(ConversionService conversionService) |
void |
setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory) |
void |
setPrimaryExpression(Expression expression)
For expression-based components, set the primary expression.
|
protected void |
setTaskScheduler(TaskScheduler taskScheduler) |
String |
toString() |
protected static final ExpressionParser EXPRESSION_PARSER
protected final Log logger
public final void setBeanName(String beanName)
setBeanName
in interface BeanNameAware
public String getComponentName()
componentName
field.
If componentName
was not set this method will default to the 'beanName' of this component;getComponentName
in interface NamedComponent
public void setComponentName(String componentName)
componentName
- The component name.public String getComponentType()
getComponentType
in interface NamedComponent
public void setBeanFactory(BeanFactory beanFactory)
setBeanFactory
in interface BeanFactoryAware
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public void setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
DestinationResolver
strategy to use.
The default is a BeanFactoryChannelResolver.channelResolver
- The channel resolver.public Expression getExpression()
ExpressionCapable
getExpression
in interface ExpressionCapable
public final void setPrimaryExpression(Expression expression)
expression
- the expression.public final void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
protected void onInit() throws Exception
Exception
- Any exception.protected BeanFactory getBeanFactory()
protected TaskScheduler getTaskScheduler()
protected DestinationResolver<MessageChannel> getChannelResolver()
protected void setTaskScheduler(TaskScheduler taskScheduler)
public ConversionService getConversionService()
protected void setConversionService(ConversionService conversionService)
public String getApplicationContextId()
ApplicationContext.getId()
if the
ApplicationContext
is available.protected ApplicationContext getApplicationContext()
protected Properties getIntegrationProperties()
IntegrationContextUtils.getIntegrationProperties(BeanFactory)
protected MessageBuilderFactory getMessageBuilderFactory()
public void setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory)
protected <T> T getIntegrationProperty(String key, Class<T> tClass)
T
- The expected type of the property.key
- Integration property.tClass
- the class to convert a value of Integration property.protected <T> T extractTypeIfPossible(Object targetObject, Class<T> expectedType)