public abstract class IntegrationObjectSupport extends java.lang.Object implements org.springframework.beans.factory.BeanNameAware, NamedComponent, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.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 org.springframework.expression.ExpressionParser |
EXPRESSION_PARSER |
protected org.apache.commons.logging.Log |
logger
Logger that is available to subclasses
|
Constructor and Description |
---|
IntegrationObjectSupport() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected <T> T |
extractTypeIfPossible(java.lang.Object targetObject,
java.lang.Class<T> expectedType) |
protected org.springframework.context.ApplicationContext |
getApplicationContext() |
java.lang.String |
getApplicationContextId()
Returns the
ApplicationContext.getId() if the
ApplicationContext is available. |
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory() |
protected org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> |
getChannelResolver() |
java.lang.String |
getComponentName()
Will return the name of this component identified by
componentName field. |
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
org.springframework.core.convert.ConversionService |
getConversionService() |
org.springframework.expression.Expression |
getExpression()
Return the primary SpEL expression if this component is expression-based.
|
protected java.util.Properties |
getIntegrationProperties() |
protected <T> T |
getIntegrationProperty(java.lang.String key,
java.lang.Class<T> tClass) |
protected MessageBuilderFactory |
getMessageBuilderFactory() |
protected org.springframework.scheduling.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(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setBeanName(java.lang.String beanName) |
void |
setChannelResolver(org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> channelResolver)
Specify the
DestinationResolver strategy to use. |
void |
setComponentName(java.lang.String componentName)
Sets the name of this component.
|
protected void |
setConversionService(org.springframework.core.convert.ConversionService conversionService) |
void |
setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory) |
void |
setPrimaryExpression(org.springframework.expression.Expression expression)
For expression-based components, set the primary expression.
|
protected void |
setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler) |
java.lang.String |
toString() |
protected static final org.springframework.expression.ExpressionParser EXPRESSION_PARSER
protected final org.apache.commons.logging.Log logger
public final void setBeanName(java.lang.String beanName)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public java.lang.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(java.lang.String componentName)
componentName
- The component name.public java.lang.String getComponentType()
getComponentType
in interface NamedComponent
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void setChannelResolver(org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> channelResolver)
DestinationResolver
strategy to use.
The default is a BeanFactoryChannelResolver.channelResolver
- The channel resolver.public org.springframework.expression.Expression getExpression()
ExpressionCapable
getExpression
in interface ExpressionCapable
public final void setPrimaryExpression(org.springframework.expression.Expression expression)
expression
- the expression.public final void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
protected void onInit() throws java.lang.Exception
java.lang.Exception
- Any exception.protected boolean isInitialized()
protected org.springframework.beans.factory.BeanFactory getBeanFactory()
protected org.springframework.scheduling.TaskScheduler getTaskScheduler()
protected org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> getChannelResolver()
protected void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
public org.springframework.core.convert.ConversionService getConversionService()
protected void setConversionService(org.springframework.core.convert.ConversionService conversionService)
public java.lang.String getApplicationContextId()
ApplicationContext.getId()
if the
ApplicationContext
is available.protected org.springframework.context.ApplicationContext getApplicationContext()
protected java.util.Properties getIntegrationProperties()
IntegrationContextUtils.getIntegrationProperties(BeanFactory)
protected MessageBuilderFactory getMessageBuilderFactory()
public void setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory)
protected <T> T getIntegrationProperty(java.lang.String key, java.lang.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(java.lang.Object targetObject, java.lang.Class<T> expectedType)
public java.lang.String toString()
toString
in class java.lang.Object