public class XmlReaderContext extends ReaderContext
ReaderContext
,
specific to use with an XmlBeanDefinitionReader
. Provides access to the
NamespaceHandlerResolver
configured in the XmlBeanDefinitionReader
.Constructor and Description |
---|
XmlReaderContext(Resource resource,
ProblemReporter problemReporter,
ReaderEventListener eventListener,
SourceExtractor sourceExtractor,
XmlBeanDefinitionReader reader,
NamespaceHandlerResolver namespaceHandlerResolver)
Construct a new
XmlReaderContext . |
Modifier and Type | Method and Description |
---|---|
String |
generateBeanName(BeanDefinition beanDefinition)
Call the bean name generator for the given bean definition.
|
ClassLoader |
getBeanClassLoader()
Return the bean class loader to use, if any.
|
Environment |
getEnvironment()
Return the environment to use.
|
NamespaceHandlerResolver |
getNamespaceHandlerResolver()
Return the namespace resolver.
|
XmlBeanDefinitionReader |
getReader()
Return the XML bean definition reader in use.
|
BeanDefinitionRegistry |
getRegistry()
Return the bean definition registry to use.
|
ResourceLoader |
getResourceLoader()
Return the resource loader to use, if any.
|
Document |
readDocumentFromString(String documentContent)
Read an XML document from the given String.
|
String |
registerWithGeneratedName(BeanDefinition beanDefinition)
Call the bean name generator for the given bean definition
and register the bean definition under the generated name.
|
error, error, error, error, extractSource, fatal, fatal, fatal, fatal, fireAliasRegistered, fireComponentRegistered, fireDefaultsRegistered, fireImportProcessed, fireImportProcessed, getResource, getSourceExtractor, warning, warning, warning, warning
public XmlReaderContext(Resource resource, ProblemReporter problemReporter, ReaderEventListener eventListener, SourceExtractor sourceExtractor, XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver)
XmlReaderContext
.resource
- the XML bean definition resourceproblemReporter
- the problem reporter in useeventListener
- the event listener in usesourceExtractor
- the source extractor in usereader
- the XML bean definition reader in usenamespaceHandlerResolver
- the XML namespace resolverpublic final XmlBeanDefinitionReader getReader()
public final BeanDefinitionRegistry getRegistry()
@Nullable public final ResourceLoader getResourceLoader()
This will be non-null in regular scenarios, also allowing access to the resource class loader.
@Nullable public final ClassLoader getBeanClassLoader()
Note that this will be null in regular scenarios, as an indication to lazily resolve bean classes.
public final Environment getEnvironment()
public final NamespaceHandlerResolver getNamespaceHandlerResolver()
public String generateBeanName(BeanDefinition beanDefinition)
public String registerWithGeneratedName(BeanDefinition beanDefinition)
AbstractBeanDefinitionReader.getBeanNameGenerator()
,
BeanNameGenerator.generateBeanName(org.springframework.beans.factory.config.BeanDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry)
,
BeanDefinitionRegistry.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
public Document readDocumentFromString(String documentContent)
getReader()