|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.xml.BeanDefinitionParserDelegate
public class BeanDefinitionParserDelegate
Stateful delegate class used to parse XML bean definitions.
Intended for use by both the main parser and any extension
BeanDefinitionParsers
or
BeanDefinitionDecorators
.
ParserContext
,
DefaultBeanDefinitionDocumentReader
Constructor Summary | |
---|---|
BeanDefinitionParserDelegate(XmlReaderContext readerContext)
Create a new BeanDefinitionParserDelegate associated with the supplied XmlReaderContext . |
Method Summary | |
---|---|
protected TypedStringValue |
buildTypedStringValue(String value,
String targetTypeName)
Build a typed String value Object for the given raw value. |
protected Object |
buildTypedStringValueForMap(String value,
String defaultTypeName,
Element entryEle)
Build a typed String value Object for the given raw value. |
protected void |
checkNameUniqueness(String beanName,
List<String> aliases,
Element beanElement)
Validate that the specified bean name and aliases have not been used already. |
protected AbstractBeanDefinition |
createBeanDefinition(String className,
String parentName)
Create a bean definition for the given class name and parent name. |
BeanDefinitionHolder |
decorateBeanDefinitionIfRequired(Element ele,
BeanDefinitionHolder definitionHolder)
|
BeanDefinitionHolder |
decorateBeanDefinitionIfRequired(Element ele,
BeanDefinitionHolder definitionHolder,
BeanDefinition containingBd)
|
protected void |
error(String message,
Element source)
Report an error with the given message for the given source element. |
protected void |
error(String message,
Element source,
Throwable cause)
Report an error with the given message for the given source element. |
protected void |
error(String message,
Node source)
Report an error with the given message for the given source element. |
protected Object |
extractSource(Element ele)
Invoke the SourceExtractor to pull the
source metadata from the supplied Element . |
String[] |
getAutowireCandidatePatterns()
Return any patterns provided in the 'default-autowire-candidates' attribute of the top-level <beans/> element. |
int |
getAutowireMode(String attValue)
|
BeanDefinitionDefaults |
getBeanDefinitionDefaults()
Return the default settings for bean definitions as indicated within the attributes of the top-level <beans/> element. |
DocumentDefaultsDefinition |
getDefaults()
Return the defaults definition object, or null if the
defaults have been initialized yet. |
int |
getDependencyCheck(String attValue)
|
String |
getLocalName(Node node)
Gets the local name for the supplied Node . |
String |
getNamespaceURI(Node node)
Gets the namespace URI for the supplied node. |
XmlReaderContext |
getReaderContext()
Get the XmlReaderContext associated with this helper instance. |
void |
initDefaults(Element root)
Initialize the default lazy-init, autowire, dependency check settings, init-method, destroy-method and merge settings. |
boolean |
isDefaultNamespace(String namespaceUri)
|
boolean |
nodeNameEquals(Node node,
String desiredName)
Determines whether the name of the supplied node is equal to the supplied name. |
Object |
parseArrayElement(Element arrayEle,
BeanDefinition bd)
Parse an array element. |
AbstractBeanDefinition |
parseBeanDefinitionAttributes(Element ele,
String beanName,
BeanDefinition containingBean,
AbstractBeanDefinition bd)
Apply the attributes of the given bean element to the given bean * definition. |
BeanDefinitionHolder |
parseBeanDefinitionElement(Element ele)
Parses the supplied <bean> element. |
BeanDefinitionHolder |
parseBeanDefinitionElement(Element ele,
BeanDefinition containingBean)
Parses the supplied <bean> element. |
AbstractBeanDefinition |
parseBeanDefinitionElement(Element ele,
String beanName,
BeanDefinition containingBean)
Parse the bean definition itself, without regard to name or aliases. |
protected void |
parseCollectionElements(NodeList elementNodes,
Collection<Object> target,
BeanDefinition bd,
String defaultElementType)
|
void |
parseConstructorArgElement(Element ele,
BeanDefinition bd)
Parse a constructor-arg element. |
void |
parseConstructorArgElements(Element beanEle,
BeanDefinition bd)
Parse constructor-arg sub-elements of the given bean element. |
BeanDefinition |
parseCustomElement(Element ele)
|
BeanDefinition |
parseCustomElement(Element ele,
BeanDefinition containingBd)
|
Object |
parseIdRefElement(Element ele)
Return a typed String value Object for the given 'idref' element. |
protected Object |
parseKeyElement(Element keyEle,
BeanDefinition bd,
String defaultKeyTypeName)
Parse a key sub-element of a map element. |
List |
parseListElement(Element collectionEle,
BeanDefinition bd)
Parse a list element. |
void |
parseLookupOverrideSubElements(Element beanEle,
MethodOverrides overrides)
Parse lookup-override sub-elements of the given bean element. |
Map |
parseMapElement(Element mapEle,
BeanDefinition bd)
Parse a map element. |
boolean |
parseMergeAttribute(Element collectionElement)
Parse the merge attribute of a collection element, if any. |
void |
parseMetaElements(Element ele,
BeanMetadataAttributeAccessor attributeAccessor)
|
void |
parsePropertyElement(Element ele,
BeanDefinition bd)
Parse a property element. |
void |
parsePropertyElements(Element beanEle,
BeanDefinition bd)
Parse property sub-elements of the given bean element. |
Object |
parsePropertySubElement(Element ele,
BeanDefinition bd)
|
Object |
parsePropertySubElement(Element ele,
BeanDefinition bd,
String defaultValueType)
Parse a value, ref or collection sub-element of a property or constructor-arg element. |
Object |
parsePropertyValue(Element ele,
BeanDefinition bd,
String propertyName)
Get the value of a property element. |
Properties |
parsePropsElement(Element propsEle)
Parse a props element. |
void |
parseQualifierElement(Element ele,
AbstractBeanDefinition bd)
Parse a qualifier element. |
void |
parseQualifierElements(Element beanEle,
AbstractBeanDefinition bd)
Parse qualifier sub-elements of the given bean element. |
void |
parseReplacedMethodSubElements(Element beanEle,
MethodOverrides overrides)
Parse replaced-method sub-elements of the given bean element. |
Set |
parseSetElement(Element collectionEle,
BeanDefinition bd)
Parse a set element. |
Object |
parseValueElement(Element ele,
String defaultTypeName)
Return a typed String value Object for the given value element. |
protected void |
populateDefaults(DocumentDefaultsDefinition defaults,
Element root)
Populate the given DocumentDefaultsDefinition instance with the default lazy-init, autowire, dependency check settings, init-method, destroy-method and merge settings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String BEANS_NAMESPACE_URI
public static final String BEAN_NAME_DELIMITERS
public static final String TRUE_VALUE
public static final String DEFAULT_VALUE
public static final String DESCRIPTION_ELEMENT
public static final String AUTOWIRE_BY_NAME_VALUE
public static final String AUTOWIRE_BY_TYPE_VALUE
public static final String AUTOWIRE_CONSTRUCTOR_VALUE
public static final String AUTOWIRE_AUTODETECT_VALUE
public static final String DEPENDENCY_CHECK_ALL_ATTRIBUTE_VALUE
public static final String DEPENDENCY_CHECK_SIMPLE_ATTRIBUTE_VALUE
public static final String DEPENDENCY_CHECK_OBJECTS_ATTRIBUTE_VALUE
public static final String NAME_ATTRIBUTE
public static final String BEAN_ELEMENT
public static final String META_ELEMENT
public static final String ID_ATTRIBUTE
public static final String PARENT_ATTRIBUTE
public static final String CLASS_ATTRIBUTE
public static final String ABSTRACT_ATTRIBUTE
public static final String SCOPE_ATTRIBUTE
public static final String SINGLETON_ATTRIBUTE
public static final String LAZY_INIT_ATTRIBUTE
public static final String AUTOWIRE_ATTRIBUTE
public static final String AUTOWIRE_CANDIDATE_ATTRIBUTE
public static final String PRIMARY_ATTRIBUTE
public static final String DEPENDENCY_CHECK_ATTRIBUTE
public static final String DEPENDS_ON_ATTRIBUTE
public static final String INIT_METHOD_ATTRIBUTE
public static final String DESTROY_METHOD_ATTRIBUTE
public static final String FACTORY_METHOD_ATTRIBUTE
public static final String FACTORY_BEAN_ATTRIBUTE
public static final String CONSTRUCTOR_ARG_ELEMENT
public static final String INDEX_ATTRIBUTE
public static final String TYPE_ATTRIBUTE
public static final String VALUE_TYPE_ATTRIBUTE
public static final String KEY_TYPE_ATTRIBUTE
public static final String PROPERTY_ELEMENT
public static final String REF_ATTRIBUTE
public static final String VALUE_ATTRIBUTE
public static final String LOOKUP_METHOD_ELEMENT
public static final String REPLACED_METHOD_ELEMENT
public static final String REPLACER_ATTRIBUTE
public static final String ARG_TYPE_ELEMENT
public static final String ARG_TYPE_MATCH_ATTRIBUTE
public static final String REF_ELEMENT
public static final String IDREF_ELEMENT
public static final String BEAN_REF_ATTRIBUTE
public static final String LOCAL_REF_ATTRIBUTE
public static final String PARENT_REF_ATTRIBUTE
public static final String VALUE_ELEMENT
public static final String NULL_ELEMENT
public static final String ARRAY_ELEMENT
public static final String LIST_ELEMENT
public static final String SET_ELEMENT
public static final String MAP_ELEMENT
public static final String ENTRY_ELEMENT
public static final String KEY_ELEMENT
public static final String KEY_ATTRIBUTE
public static final String KEY_REF_ATTRIBUTE
public static final String VALUE_REF_ATTRIBUTE
public static final String PROPS_ELEMENT
public static final String PROP_ELEMENT
public static final String MERGE_ATTRIBUTE
public static final String QUALIFIER_ELEMENT
public static final String QUALIFIER_ATTRIBUTE_ELEMENT
public static final String DEFAULT_LAZY_INIT_ATTRIBUTE
public static final String DEFAULT_MERGE_ATTRIBUTE
public static final String DEFAULT_AUTOWIRE_ATTRIBUTE
public static final String DEFAULT_DEPENDENCY_CHECK_ATTRIBUTE
public static final String DEFAULT_AUTOWIRE_CANDIDATES_ATTRIBUTE
public static final String DEFAULT_INIT_METHOD_ATTRIBUTE
public static final String DEFAULT_DESTROY_METHOD_ATTRIBUTE
protected final Log logger
Constructor Detail |
---|
public BeanDefinitionParserDelegate(XmlReaderContext readerContext)
XmlReaderContext
.
Method Detail |
---|
public final XmlReaderContext getReaderContext()
XmlReaderContext
associated with this helper instance.
protected Object extractSource(Element ele)
SourceExtractor
to pull the
source metadata from the supplied Element
.
protected void error(String message, Node source)
protected void error(String message, Element source)
protected void error(String message, Element source, Throwable cause)
public void initDefaults(Element root)
populateDefaults(DocumentDefaultsDefinition, org.w3c.dom.Element)
,
getDefaults()
protected void populateDefaults(DocumentDefaultsDefinition defaults, Element root)
public DocumentDefaultsDefinition getDefaults()
null
if the
defaults have been initialized yet.
public BeanDefinitionDefaults getBeanDefinitionDefaults()
<beans/>
element.
public String[] getAutowireCandidatePatterns()
<beans/>
element.
public BeanDefinitionHolder parseBeanDefinitionElement(Element ele)
<bean>
element. May return null
if there were errors during parse. Errors are reported to the
ProblemReporter
.
public BeanDefinitionHolder parseBeanDefinitionElement(Element ele, BeanDefinition containingBean)
<bean>
element. May return null
if there were errors during parse. Errors are reported to the
ProblemReporter
.
protected void checkNameUniqueness(String beanName, List<String> aliases, Element beanElement)
public AbstractBeanDefinition parseBeanDefinitionElement(Element ele, String beanName, BeanDefinition containingBean)
null
if problems occured during the parse of the bean definition.
public AbstractBeanDefinition parseBeanDefinitionAttributes(Element ele, String beanName, BeanDefinition containingBean, AbstractBeanDefinition bd)
ele
- bean declaration elementbeanName
- bean namecontainingBean
- containing bean definition
protected AbstractBeanDefinition createBeanDefinition(String className, String parentName) throws ClassNotFoundException
className
- the name of the bean classparentName
- the name of the bean's parent bean
ClassNotFoundException
- if bean class resolution was attempted but failedpublic void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attributeAccessor)
public int getAutowireMode(String attValue)
public int getDependencyCheck(String attValue)
public void parseConstructorArgElements(Element beanEle, BeanDefinition bd)
public void parsePropertyElements(Element beanEle, BeanDefinition bd)
public void parseQualifierElements(Element beanEle, AbstractBeanDefinition bd)
public void parseLookupOverrideSubElements(Element beanEle, MethodOverrides overrides)
public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides)
public void parseConstructorArgElement(Element ele, BeanDefinition bd)
public void parsePropertyElement(Element ele, BeanDefinition bd)
public void parseQualifierElement(Element ele, AbstractBeanDefinition bd)
public Object parsePropertyValue(Element ele, BeanDefinition bd, String propertyName)
public Object parsePropertySubElement(Element ele, BeanDefinition bd)
public Object parsePropertySubElement(Element ele, BeanDefinition bd, String defaultValueType)
ele
- subelement of property element; we don't know which yetdefaultValueType
- the default type (class name) for any
<value>
tag that might be createdpublic Object parseIdRefElement(Element ele)
public Object parseValueElement(Element ele, String defaultTypeName)
protected TypedStringValue buildTypedStringValue(String value, String targetTypeName) throws ClassNotFoundException
ClassNotFoundException
TypedStringValue
public Object parseArrayElement(Element arrayEle, BeanDefinition bd)
public List parseListElement(Element collectionEle, BeanDefinition bd)
public Set parseSetElement(Element collectionEle, BeanDefinition bd)
protected void parseCollectionElements(NodeList elementNodes, Collection<Object> target, BeanDefinition bd, String defaultElementType)
public Map parseMapElement(Element mapEle, BeanDefinition bd)
protected final Object buildTypedStringValueForMap(String value, String defaultTypeName, Element entryEle)
TypedStringValue
protected Object parseKeyElement(Element keyEle, BeanDefinition bd, String defaultKeyTypeName)
public Properties parsePropsElement(Element propsEle)
public boolean parseMergeAttribute(Element collectionElement)
public BeanDefinition parseCustomElement(Element ele)
public BeanDefinition parseCustomElement(Element ele, BeanDefinition containingBd)
public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele, BeanDefinitionHolder definitionHolder)
public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele, BeanDefinitionHolder definitionHolder, BeanDefinition containingBd)
public boolean isDefaultNamespace(String namespaceUri)
public String getNamespaceURI(Node node)
Node.getNamespaceURI()
.
Subclasses may override the default implementation to provide a different namespace identification mechanism.
node
- the node
public boolean nodeNameEquals(Node node, String desiredName)
node
- the node to comparedesiredName
- the name to check for
true
if the names are equal otherwise false
.public String getLocalName(Node node)
Node
. The default implementation calls Node.getLocalName()
.
Subclasses may override the default implementation to provide a different mechanism for getting the local name.
node
- the Node
Node
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |