org.mule.config.spring.parsers.assembly
Interface BeanAssembler

All Known Implementing Classes:
AbstractMapBeanAssembler, AttributeMapBeanAssembler, DefaultBeanAssembler, TwoStageMapBeanAssembler

public interface BeanAssembler

Bean Assembler provides a high-level interface to constructing beans. It encapsulates all the "smart" logic about collections, maps, references, etc.

A bean assembly contains a bean (the thing we are constructing), a target (where we put the bean once it is ready) and appropriate configuration information (there is a configuration for both bean and target, but currently they are set to the same instance by the classes that use this).


Method Summary
 void copyBeanToTarget()
          Copy the properties from the bean we have been building into the target (typically the parent bean).
 void extendBean(Attr attribute)
          Add a property defined by an attribute to the bean we are constructing.
 void extendBean(String newName, Object newValue, boolean isReference)
          Allow direct access to bean for more complex cases
 void extendTarget(Attr attribute)
          Add a property defined by an attribute to the parent of the bean we are constructing.
 void extendTarget(String newName, Object newValue, boolean isReference)
          Allow direct access to target for more complex cases
 void extendTarget(String oldName, String newName, Object newValue)
           
 org.springframework.beans.factory.support.BeanDefinitionBuilder getBean()
           
 org.springframework.beans.factory.config.BeanDefinition getTarget()
           
 void insertBeanInTarget(String oldName)
          Insert the bean we have built into the target (typically the parent bean).
 void insertSingletonBeanInTarget(String propertyName, String singletonName)
           
 void setBeanFlag(String flag)
          Set a flag on the bean - this is used to communicate with MuleHierarchicalBeanDefinitionParserDelegate
 

Method Detail

getBean

org.springframework.beans.factory.support.BeanDefinitionBuilder getBean()

getTarget

org.springframework.beans.factory.config.BeanDefinition getTarget()

extendBean

void extendBean(Attr attribute)
Add a property defined by an attribute to the bean we are constructing.

Since an attribute value is always a string, we don't have to deal with complex types here - the only issue is whether or not we have a reference. References are detected by explicit annotation or by the "-ref" at the end of an attribute name. We do not check the Spring repo to see if a name already exists since that could lead to unpredictable behaviour. (see PropertyConfiguration)

Parameters:
attribute - The attribute to add

extendBean

void extendBean(String newName,
                Object newValue,
                boolean isReference)
Allow direct access to bean for more complex cases

Parameters:
newName - The property name to add
newValue - The property value to add
isReference - If true, a bean reference is added (and newValue must be a String)

extendTarget

void extendTarget(Attr attribute)
Add a property defined by an attribute to the parent of the bean we are constructing.

This is unusual. Normally you want extendBean(org.w3c.dom.Attr).

Parameters:
attribute - The attribute to add

extendTarget

void extendTarget(String newName,
                  Object newValue,
                  boolean isReference)
Allow direct access to target for more complex cases

Parameters:
newName - The property name to add
newValue - The property value to add
isReference - If true, a bean reference is added (and newValue must be a String)

extendTarget

void extendTarget(String oldName,
                  String newName,
                  Object newValue)

insertBeanInTarget

void insertBeanInTarget(String oldName)
Insert the bean we have built into the target (typically the parent bean).

This is the most complex case because the bean can have an arbitrary type.

Parameters:
oldName - The identifying the bean (typically element name).

insertSingletonBeanInTarget

void insertSingletonBeanInTarget(String propertyName,
                                 String singletonName)

copyBeanToTarget

void copyBeanToTarget()
Copy the properties from the bean we have been building into the target (typically the parent bean). In other words, the bean is a facade for the target.

This assumes that the source bean has been constructed correctly (ie the decisions about what is ignored, a map, a list, etc) have already been made. All it does (apart from a direct copy) is merge collections with those on the target when necessary.


setBeanFlag

void setBeanFlag(String flag)
Set a flag on the bean - this is used to communicate with MuleHierarchicalBeanDefinitionParserDelegate

Parameters:
flag - The flag to set


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.