Spring AMQP

org.springframework.amqp.rabbit.config
Class NamespaceUtils

java.lang.Object
  extended by org.springframework.amqp.rabbit.config.NamespaceUtils

public abstract class NamespaceUtils
extends Object

Shared utility methods for namespace parsers.


Constructor Summary
NamespaceUtils()
           
 
Method Summary
static void addConstructorArgRefIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName)
          Populates the bean definition constructor argument with a reference to a bean with id equal to the attribute if it is defined in the given element.
static void addConstructorArgValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName)
          Populates the bean definition constructor argument with the value of that attribute if it is defined in the given element.
static String createElementDescription(Element element)
          Provides a user friendly description of an element based on its node name and, if available, its "id" attribute value.
static BeanComponentDefinition parseInnerBeanDefinition(Element element, ParserContext parserContext)
           
static void setReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, 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(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName)
          Populates the specified bean definition property with the reference to a bean.
static void setValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, 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(BeanDefinitionBuilder builder, Element element, String attributeName, 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

NamespaceUtils

public NamespaceUtils()
Method Detail

setValueIfAttributeDefined

public static void setValueIfAttributeDefined(BeanDefinitionBuilder builder,
                                              Element element,
                                              String attributeName,
                                              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:
builder - the bean definition builder 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(BeanDefinitionBuilder builder,
                                              Element element,
                                              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:
builder - the bean definition builder 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)

addConstructorArgValueIfAttributeDefined

public static void addConstructorArgValueIfAttributeDefined(BeanDefinitionBuilder builder,
                                                            Element element,
                                                            String attributeName)
Populates the bean definition constructor argument with the value of that attribute if it is defined in the given element.

Parameters:
builder - the bean definition builder 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 constructor argument

addConstructorArgRefIfAttributeDefined

public static void addConstructorArgRefIfAttributeDefined(BeanDefinitionBuilder builder,
                                                          Element element,
                                                          String attributeName)
Populates the bean definition constructor argument with a reference to a bean with id equal to the attribute if it is defined in the given element.

Parameters:
builder - the bean definition builder 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 set the reference

setReferenceIfAttributeDefined

public static void setReferenceIfAttributeDefined(BeanDefinitionBuilder builder,
                                                  Element element,
                                                  String attributeName,
                                                  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:
builder - the bean definition builder 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(BeanDefinitionBuilder builder,
                                                  Element element,
                                                  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:
builder - the bean definition builder 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)

createElementDescription

public static String createElementDescription(Element element)
Provides a user friendly description of an element based on its node name and, if available, its "id" attribute value. This is useful for creating error messages from within bean definition parsers.


parseInnerBeanDefinition

public static BeanComponentDefinition parseInnerBeanDefinition(Element element,
                                                               ParserContext parserContext)

Spring AMQP

Copyright © 2011. All Rights Reserved.