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() |
static <T> T |
extractTypeIfPossible(Object targetObject,
Class<T> expectedType) |
static UUID |
generateId() |
protected ApplicationContext |
getApplicationContext() |
String |
getApplicationContextId()
Returns the
ApplicationContext.getId() if the
ApplicationContext is available. |
String |
getBeanDescription() |
protected BeanFactory |
getBeanFactory() |
String |
getBeanName() |
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 boolean |
isInitialized()
Return the status of this component if it has been initialized already.
|
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.
|
void |
setTaskScheduler(TaskScheduler taskScheduler)
Configure a
TaskScheduler for those components which logic relies
on the scheduled tasks. |
String |
toString() |
protected static final ExpressionParser EXPRESSION_PARSER
protected final Log logger
public final void setBeanName(String beanName)
setBeanName in interface BeanNameAwarepublic String getBeanName()
getBeanName in interface NamedComponentpublic String getComponentName()
componentName field.
If componentName was not set this method will default to the 'beanName' of this component;getComponentName in interface NamedComponentpublic void setComponentName(String componentName)
componentName - The component name.public String getComponentType()
getComponentType in interface NamedComponentpublic String getBeanDescription()
public void setBeanFactory(BeanFactory beanFactory)
setBeanFactory in interface BeanFactoryAwarepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionpublic void setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
DestinationResolver strategy to use.
The default is a BeanFactoryChannelResolver.channelResolver - The channel resolver.public Expression getExpression()
ExpressionCapablegetExpression in interface ExpressionCapablepublic final void setPrimaryExpression(Expression expression)
expression - the expression.public final void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanprotected void onInit()
protected boolean isInitialized()
protected BeanFactory getBeanFactory()
public void setTaskScheduler(TaskScheduler taskScheduler)
TaskScheduler for those components which logic relies
on the scheduled tasks.
If not provided, falls back to the global taskScheduler bean
in the application context, provided by the Spring Integration infrastructure.taskScheduler - the TaskScheduler to use.getTaskScheduler()protected TaskScheduler getTaskScheduler()
protected DestinationResolver<MessageChannel> getChannelResolver()
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.@Nullable public static <T> T extractTypeIfPossible(@Nullable Object targetObject, Class<T> expectedType)
public static UUID generateId()