public class DefaultBeanAssembler extends Object implements BeanAssembler
Modifier and Type | Field and Description |
---|---|
protected org.springframework.beans.factory.support.BeanDefinitionBuilder |
bean |
protected org.springframework.beans.factory.config.BeanDefinition |
target |
protected PropertyConfiguration |
targetConfig |
Constructor and Description |
---|
DefaultBeanAssembler(PropertyConfiguration beanConfig,
org.springframework.beans.factory.support.BeanDefinitionBuilder bean,
PropertyConfiguration targetConfig,
org.springframework.beans.factory.config.BeanDefinition target) |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotationValue(org.springframework.beans.MutablePropertyValues properties,
QName name,
Object value)
Add a key/value pair to existing
AnnotatedObject.PROPERTY_NAME property value. |
protected void |
addPropertyWithoutReference(org.springframework.beans.MutablePropertyValues properties,
SingleProperty config,
String name,
Object value) |
protected void |
addPropertyWithReference(org.springframework.beans.MutablePropertyValues properties,
SingleProperty config,
String name,
Object value) |
protected void |
assertTargetPresent() |
protected static String |
bestGuessName(PropertyConfiguration config,
String oldName,
String className) |
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 major hacks
|
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 major hacks
|
void |
extendTarget(String oldName,
String newName,
Object newValue) |
org.springframework.beans.factory.support.BeanDefinitionBuilder |
getBean() |
protected PropertyConfiguration |
getBeanConfig() |
org.springframework.beans.factory.config.BeanDefinition |
getTarget() |
protected PropertyConfiguration |
getTargetConfig() |
void |
insertBeanInTarget(String oldName)
Insert the bean we have built into the target (typically the parent bean).
|
protected void |
insertInTarget(String oldName) |
void |
insertSingletonBeanInTarget(String propertyName,
String singletonName) |
boolean |
isAnnotationsPropertyAvailable(Class<?> beanClass) |
boolean |
isAnnotationsPropertyAvailable(String beanClassName) |
protected static boolean |
methodExists(String className,
String newName) |
protected static List |
retrieveList(Object value) |
protected void |
setBean(org.springframework.beans.factory.support.BeanDefinitionBuilder bean) |
void |
setBeanFlag(String flag)
Set a flag on the bean - this is used to communicate with
MuleHierarchicalBeanDefinitionParserDelegate |
protected org.springframework.beans.factory.support.BeanDefinitionBuilder bean
protected PropertyConfiguration targetConfig
protected org.springframework.beans.factory.config.BeanDefinition target
public DefaultBeanAssembler(PropertyConfiguration beanConfig, org.springframework.beans.factory.support.BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, org.springframework.beans.factory.config.BeanDefinition target)
public org.springframework.beans.factory.support.BeanDefinitionBuilder getBean()
getBean
in interface BeanAssembler
protected void setBean(org.springframework.beans.factory.support.BeanDefinitionBuilder bean)
public org.springframework.beans.factory.config.BeanDefinition getTarget()
getTarget
in interface BeanAssembler
protected PropertyConfiguration getBeanConfig()
protected PropertyConfiguration getTargetConfig()
public void extendBean(Attr attribute)
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
)
extendBean
in interface BeanAssembler
attribute
- The attribute to addpublic final boolean isAnnotationsPropertyAvailable(Class<?> beanClass)
public final boolean isAnnotationsPropertyAvailable(String beanClassName)
public void extendBean(String newName, Object newValue, boolean isReference)
extendBean
in interface BeanAssembler
newName
- The property name to addnewValue
- The property value to addisReference
- If true, a bean reference is added (and newValue must be a String)public void extendTarget(Attr attribute)
This is unusual. Normally you want extendBean(org.w3c.dom.Attr)
.
extendTarget
in interface BeanAssembler
attribute
- The attribute to addpublic void extendTarget(String newName, Object newValue, boolean isReference)
extendTarget
in interface BeanAssembler
newName
- The property name to addnewValue
- The property value to addisReference
- If true, a bean reference is added (and newValue must be a String)public void extendTarget(String oldName, String newName, Object newValue)
extendTarget
in interface BeanAssembler
public void insertBeanInTarget(String oldName)
This is the most complex case because the bean can have an aribtrary type.
insertBeanInTarget
in interface BeanAssembler
oldName
- The identifying the bean (typically element name).public void insertSingletonBeanInTarget(String propertyName, String singletonName)
insertSingletonBeanInTarget
in interface BeanAssembler
protected void insertInTarget(String oldName)
public void copyBeanToTarget()
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.
copyBeanToTarget
in interface BeanAssembler
public void setBeanFlag(String flag)
BeanAssembler
MuleHierarchicalBeanDefinitionParserDelegate
setBeanFlag
in interface BeanAssembler
flag
- The flag to setprotected void assertTargetPresent()
public final void addAnnotationValue(org.springframework.beans.MutablePropertyValues properties, QName name, Object value)
AnnotatedObject.PROPERTY_NAME
property value.protected void addPropertyWithReference(org.springframework.beans.MutablePropertyValues properties, SingleProperty config, String name, Object value)
protected void addPropertyWithoutReference(org.springframework.beans.MutablePropertyValues properties, SingleProperty config, String name, Object value)
protected static String bestGuessName(PropertyConfiguration config, String oldName, String className)
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.