Package org.springframework.beans.factory.parsing

# Class ReaderContext

java.lang.Object
org.springframework.beans.factory.parsing.ReaderContext

Direct Known Subclasses:
  `XmlReaderContext`

public class ReaderContext extends Object
Context that gets passed along a bean definition reading process, encapsulating all relevant configuration as well as state.

Since:
  2.0
Author:
  Rob Harrop, Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`ReaderContext(org.springframework.core.io.Resource resource, ProblemReporter problemReporter, ReaderEventListener eventListener, SourceExtractor sourceExtractor)`
Construct a new `ReaderContext`.

## Method Summary

Modifier and Type
Method
Description
`void`
`error(String message, Object source)`
Raise a regular error.
`void`
`error(String message, Object source, Throwable cause)`
Raise a regular error.
`void`
`error(String message, Object source, ParseState parseState)`
Raise a regular error.
`void`
`error(String message, Object source, ParseState parseState, Throwable cause)`
Raise a regular error.
`Object`
`extractSource(Object sourceCandidate)`
Call the source extractor for the given source object.
`void`
`fatal(String message, Object source)`
Raise a fatal error.
`void`
`fatal(String message, Object source, Throwable cause)`
Raise a fatal error.
`void`
`fatal(String message, Object source, ParseState parseState)`
Raise a fatal error.
`void`
`fatal(String message, Object source, ParseState parseState, Throwable cause)`
Raise a fatal error.
`void`
`fireAliasRegistered(String beanName, String alias, Object source)`
Fire an alias-registered event.
`void`
`fireComponentRegistered(ComponentDefinition componentDefinition)`
Fire a component-registered event.
`void`
`fireDefaultsRegistered(DefaultsDefinition defaultsDefinition)`
Fire a defaults-registered event.
`void`
`fireImportProcessed(String importedResource, Object source)`
Fire an import-processed event.
`void`
`fireImportProcessed(String importedResource, org.springframework.core.io.Resource[] actualResources, Object source)`
Fire an import-processed event.
`final org.springframework.core.io.Resource`
`getResource()`
`SourceExtractor`
`getSourceExtractor()`
Return the source extractor in use.
`void`
`warning(String message, Object source)`
Raise a non-critical warning.
`void`
`warning(String message, Object source, Throwable cause)`
Raise a non-critical warning.
`void`
`warning(String message, Object source, ParseState parseState)`
Raise a non-critical warning.
`void`
`warning(String message, Object source, ParseState parseState, Throwable cause)`
Raise a non-critical warning.

### Methods inherited from class java.lang.Object

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

## Constructor Details

### ReaderContext

public ReaderContext(org.springframework.core.io.Resource resource, ProblemReporter problemReporter, ReaderEventListener eventListener, SourceExtractor sourceExtractor)
Construct a new `ReaderContext`.

Parameters:
  `resource` - the XML bean definition resource
  `problemReporter` - the problem reporter in use
  `eventListener` - the event listener in use
  `sourceExtractor` - the source extractor in use

## Method Details

### getResource

public final org.springframework.core.io.Resource getResource()

### fatal

public void fatal(String message, @Nullable Object source)
Raise a fatal error.

### fatal

public void fatal(String message, @Nullable Object source, @Nullable Throwable cause)
Raise a fatal error.

### fatal

public void fatal(String message, @Nullable Object source, @Nullable ParseState parseState)
Raise a fatal error.

### fatal

public void fatal(String message, @Nullable Object source, @Nullable ParseState parseState, @Nullable Throwable cause)
Raise a fatal error.

### error

public void error(String message, @Nullable Object source)
Raise a regular error.

### error

public void error(String message, @Nullable Object source, @Nullable Throwable cause)
Raise a regular error.

### error

public void error(String message, @Nullable Object source, @Nullable ParseState parseState)
Raise a regular error.

### error

public void error(String message, @Nullable Object source, @Nullable ParseState parseState, @Nullable Throwable cause)
Raise a regular error.

### warning

public void warning(String message, @Nullable Object source)
Raise a non-critical warning.

### warning

public void warning(String message, @Nullable Object source, @Nullable Throwable cause)
Raise a non-critical warning.

### warning

public void warning(String message, @Nullable Object source, @Nullable ParseState parseState)
Raise a non-critical warning.

### warning

public void warning(String message, @Nullable Object source, @Nullable ParseState parseState, @Nullable Throwable cause)
Raise a non-critical warning.

### fireDefaultsRegistered

public void fireDefaultsRegistered(DefaultsDefinition defaultsDefinition)
Fire a defaults-registered event.

### fireComponentRegistered

public void fireComponentRegistered(ComponentDefinition componentDefinition)
Fire a component-registered event.

### fireAliasRegistered

public void fireAliasRegistered(String beanName, String alias, @Nullable Object source)
Fire an alias-registered event.

### fireImportProcessed

public void fireImportProcessed(String importedResource, @Nullable Object source)
Fire an import-processed event.

### fireImportProcessed

public void fireImportProcessed(String importedResource, org.springframework.core.io.Resource[] actualResources, @Nullable Object source)
Fire an import-processed event.

### getSourceExtractor

public SourceExtractor getSourceExtractor()
Return the source extractor in use.

### extractSource

@Nullable public Object extractSource(Object sourceCandidate)
Call the source extractor for the given source object.

Parameters:
  `sourceCandidate` - the original source object
Returns:
  the source object to store, or `null` for none.
See Also:
  - `getSourceExtractor()`
  - `SourceExtractor.extractSource(java.lang.Object, org.springframework.core.io.Resource)`