org.springframework.beans.factory.xml

## 类 XmlReaderContext

- java.lang.Object
- - org.springframework.beans.factory.parsing.ReaderContext
  - - org.springframework.beans.factory.xml.XmlReaderContext

-     public class XmlReaderContext
      extends ReaderContext

  Extension of `ReaderContext`, specific to use with an `XmlBeanDefinitionReader`. Provides access to the `NamespaceHandlerResolver` configured in the `XmlBeanDefinitionReader`.
  从以下版本开始:
    2.0
  作者:
    Rob Harrop, Juergen Hoeller

- - ### 构造器概要

    构造器
    构造器和说明
    `XmlReaderContext(org.springframework.core.io.Resource resource, ProblemReporter problemReporter, ReaderEventListener eventListener, SourceExtractor sourceExtractor, XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver)` Construct a new `XmlReaderContext`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `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.
    `org.springframework.core.env.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.
    `org.springframework.core.io.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.

    - ### 从类继承的方法 org.springframework.beans.factory.parsing.ReaderContext

      `error, error, error, error, extractSource, fatal, fatal, fatal, fatal, fireAliasRegistered, fireComponentRegistered, fireDefaultsRegistered, fireImportProcessed, fireImportProcessed, getResource, getSourceExtractor, warning, warning, warning, warning`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### XmlReaderContext

          public XmlReaderContext(org.springframework.core.io.Resource resource,
                                  ProblemReporter problemReporter,
                                  ReaderEventListener eventListener,
                                  SourceExtractor sourceExtractor,
                                  XmlBeanDefinitionReader reader,
                                  NamespaceHandlerResolver namespaceHandlerResolver)

      Construct a new `XmlReaderContext`.
      参数:
        `resource` - the XML bean definition resource
        `problemReporter` - the problem reporter in use
        `eventListener` - the event listener in use
        `sourceExtractor` - the source extractor in use
        `reader` - the XML bean definition reader in use
        `namespaceHandlerResolver` - the XML namespace resolver

  - ### 方法详细资料

    - #### getReader

          public final XmlBeanDefinitionReader getReader()

      Return the XML bean definition reader in use.

    - #### getRegistry

          public final BeanDefinitionRegistry getRegistry()

      Return the bean definition registry to use.
      另请参阅:
        `XmlBeanDefinitionReader.XmlBeanDefinitionReader(BeanDefinitionRegistry)`

    - #### getResourceLoader

          @Nullable
          public final org.springframework.core.io.ResourceLoader getResourceLoader()

      Return the resource loader to use, if any.

      This will be non-null in regular scenarios, also allowing access to the resource class loader.

      另请参阅:
        `AbstractBeanDefinitionReader.setResourceLoader(org.springframework.core.io.ResourceLoader)`, `ResourceLoader.getClassLoader()`

    - #### getBeanClassLoader

          @Nullable
          public final ClassLoader getBeanClassLoader()

      Return the bean class loader to use, if any.

      Note that this will be null in regular scenarios, as an indication to lazily resolve bean classes.

      另请参阅:
        `AbstractBeanDefinitionReader.setBeanClassLoader(java.lang.ClassLoader)`

    - #### getEnvironment

          public final org.springframework.core.env.Environment getEnvironment()

      Return the environment to use.
      另请参阅:
        `AbstractBeanDefinitionReader.setEnvironment(org.springframework.core.env.Environment)`

    - #### getNamespaceHandlerResolver

          public final NamespaceHandlerResolver getNamespaceHandlerResolver()

      Return the namespace resolver.
      另请参阅:
        `XmlBeanDefinitionReader.setNamespaceHandlerResolver(org.springframework.beans.factory.xml.NamespaceHandlerResolver)`

    - #### generateBeanName

          public String generateBeanName(BeanDefinition beanDefinition)

      Call the bean name generator for the given bean definition.
      另请参阅:
        `AbstractBeanDefinitionReader.getBeanNameGenerator()`, `BeanNameGenerator.generateBeanName(org.springframework.beans.factory.config.BeanDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry)`

    - #### registerWithGeneratedName

          public String registerWithGeneratedName(BeanDefinition beanDefinition)

      Call the bean name generator for the given bean definition and register the bean definition under the generated name.
      另请参阅:
        `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)`

    - #### readDocumentFromString

          public Document readDocumentFromString(String documentContent)

      Read an XML document from the given String.
      另请参阅:
        `getReader()`