org.springframework.integration.config
Class IntegrationNamespaceUtils

java.lang.Object
  extended by org.springframework.integration.config.IntegrationNamespaceUtils

public abstract class IntegrationNamespaceUtils
extends java.lang.Object

Shared utility methods for integration namespace parsers.

Author:
Mark Fisher, Marius Bogoevici

Constructor Summary
IntegrationNamespaceUtils()
           
 
Method Summary
static java.lang.String parseBeanDefinitionElement(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext)
           
static java.lang.String parsePoller(java.lang.String sourceBeanName, org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext)
          Parse a "poller" element and return the bean name of the poller instance.
static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName)
          Populates the bean definition property corresponding to the specified attributeName with the reference to a bean identified by the value of that attribute if the attribute is defined in the given element.
static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String propertyName)
          Populates the specified bean definition property with the reference to a bean.
static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName)
          Populates the bean definition property corresponding to the specified attributeName with the value of that attribute if it is defined in the given element.
static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String propertyName)
          Populates the specified bean definition property with the value of the attribute whose name is provided if that attribute is defined in the given element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegrationNamespaceUtils

public IntegrationNamespaceUtils()
Method Detail

setValueIfAttributeDefined

public static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder,
                                              org.w3c.dom.Element element,
                                              java.lang.String attributeName,
                                              java.lang.String propertyName)
Populates the specified bean definition property with the value of the attribute whose name is provided if that attribute is defined in the given element.

Parameters:
beanDefinition - the bean definition to be configured
element - the XML element where the attribute should be defined
attributeName - the name of the attribute whose value will be used to populate the property
propertyName - the name of the property to be populated

setValueIfAttributeDefined

public static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder,
                                              org.w3c.dom.Element element,
                                              java.lang.String attributeName)
Populates the bean definition property corresponding to the specified attributeName with the value of that attribute if it is defined in the given element.

The property name will be the camel-case equivalent of the lower case hyphen separated attribute (e.g. the "foo-bar" attribute would match the "fooBar" property).

Parameters:
beanDefinition - - the bean definition to be configured
element - - the XML element where the attribute should be defined
attributeName - - the name of the attribute whose value will be set on the property
See Also:
Conventions.attributeNameToPropertyName(String)

setReferenceIfAttributeDefined

public static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder,
                                                  org.w3c.dom.Element element,
                                                  java.lang.String attributeName,
                                                  java.lang.String propertyName)
Populates the specified bean definition property with the reference to a bean. The bean reference is identified by the value from the attribute whose name is provided if that attribute is defined in the given element.

Parameters:
beanDefinition - the bean definition to be configured
element - the XML element where the attribute should be defined
attributeName - the name of the attribute whose value will be used as a bean reference to populate the property
propertyName - the name of the property to be populated

setReferenceIfAttributeDefined

public static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder,
                                                  org.w3c.dom.Element element,
                                                  java.lang.String attributeName)
Populates the bean definition property corresponding to the specified attributeName with the reference to a bean identified by the value of that attribute if the attribute is defined in the given element.

The property name will be the camel-case equivalent of the lower case hyphen separated attribute (e.g. the "foo-bar" attribute would match the "fooBar" property).

Parameters:
beanDefinition - - the bean definition to be configured
element - - the XML element where the attribute should be defined
attributeName - - the name of the attribute whose value will be used as a bean reference to populate the property
See Also:
Conventions.attributeNameToPropertyName(String), Conventions.attributeNameToPropertyName(String)

parseBeanDefinitionElement

public static java.lang.String parseBeanDefinitionElement(org.w3c.dom.Element element,
                                                          org.springframework.beans.factory.xml.ParserContext parserContext)

parsePoller

public static java.lang.String parsePoller(java.lang.String sourceBeanName,
                                           org.w3c.dom.Element element,
                                           org.springframework.beans.factory.xml.ParserContext parserContext)
Parse a "poller" element and return the bean name of the poller instance.

Parameters:
sourceBeanName - the name of the PollableSource bean
element - the "poller" element to parse
parserContext - the parserContext for registering a newly created bean definition
Returns:
the name of the poller bean definition