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(Resource resource, ProblemReporter problemReporter, ReaderEventListener eventListener, SourceExtractor sourceExtractor)Construct a newReaderContext.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderror(String message, Object source)Raise a regular error.voiderror(String message, Object source, Throwable ex)Raise a regular error.voiderror(String message, Object source, ParseState parseState)Raise a regular error.voiderror(String message, Object source, ParseState parseState, Throwable cause)Raise a regular error.ObjectextractSource(Object sourceCandidate)Call the source extractor for the given source object.voidfatal(String message, Object source)Raise a fatal error.voidfatal(String message, Object source, Throwable ex)Raise a fatal error.voidfatal(String message, Object source, ParseState parseState)Raise a fatal error.voidfatal(String message, Object source, ParseState parseState, Throwable cause)Raise a fatal error.voidfireAliasRegistered(String beanName, String alias, Object source)Fire an alias-registered event.voidfireComponentRegistered(ComponentDefinition componentDefinition)Fire an component-registered event.voidfireDefaultsRegistered(DefaultsDefinition defaultsDefinition)Fire an defaults-registered event.voidfireImportProcessed(String importedResource, Object source)Fire an import-processed event.voidfireImportProcessed(String importedResource, Resource[] actualResources, Object source)Fire an import-processed event.ResourcegetResource()SourceExtractorgetSourceExtractor()Return the source extractor in use.voidwarning(String message, Object source)Raise a non-critical warning.voidwarning(String message, Object source, Throwable ex)Raise a non-critical warning.voidwarning(String message, Object source, ParseState parseState)Raise a non-critical warning.voidwarning(String message, Object source, ParseState parseState, Throwable cause)Raise a non-critical warning.
Constructor Detail
ReaderContext
public ReaderContext(Resource resource, ProblemReporter problemReporter, ReaderEventListener eventListener, SourceExtractor sourceExtractor)
Construct a newReaderContext.- Parameters:
resource- the XML bean definition resourceproblemReporter- the problem reporter in useeventListener- the event listener in usesourceExtractor- the source extractor in use
Method Detail
getResource
public final Resource getResource()
fatal
public void fatal(String message, Object source, ParseState parseState)
Raise a fatal error.
fatal
public void fatal(String message, Object source, ParseState parseState, Throwable cause)
Raise a fatal error.
error
public void error(String message, Object source, ParseState parseState)
Raise a regular error.
error
public void error(String message, Object source, ParseState parseState, Throwable cause)
Raise a regular error.
warning
public void warning(String message, Object source, Throwable ex)
Raise a non-critical warning.
warning
public void warning(String message, Object source, ParseState parseState)
Raise a non-critical warning.
warning
public void warning(String message, Object source, ParseState parseState, Throwable cause)
Raise a non-critical warning.
fireDefaultsRegistered
public void fireDefaultsRegistered(DefaultsDefinition defaultsDefinition)
Fire an defaults-registered event.
fireComponentRegistered
public void fireComponentRegistered(ComponentDefinition componentDefinition)
Fire an component-registered event.
fireAliasRegistered
public void fireAliasRegistered(String beanName, String alias, Object source)
Fire an alias-registered event.
fireImportProcessed
public void fireImportProcessed(String importedResource, Object source)
Fire an import-processed event.
fireImportProcessed
public void fireImportProcessed(String importedResource, Resource[] actualResources, Object source)
Fire an import-processed event.
getSourceExtractor
public SourceExtractor getSourceExtractor()
Return the source extractor in use.
extractSource
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
nullfor none. - See Also:
getSourceExtractor(),SourceExtractor.extractSource(java.lang.Object, org.springframework.core.io.Resource)