polishing

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2371 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2009-11-12 02:11:12 +00:00
parent ece535fe9c
commit 90821fb64b
2 changed files with 43 additions and 44 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,7 +38,7 @@ public interface DocumentLoader {
* @param validationMode the type of validation * @param validationMode the type of validation
* {@link org.springframework.util.xml.XmlValidationModeDetector#VALIDATION_DTD DTD} * {@link org.springframework.util.xml.XmlValidationModeDetector#VALIDATION_DTD DTD}
* or {@link org.springframework.util.xml.XmlValidationModeDetector#VALIDATION_XSD XSD}) * or {@link org.springframework.util.xml.XmlValidationModeDetector#VALIDATION_XSD XSD})
* @param namespaceAware <code>true</code> if the loading is provide support for XML namespaces * @param namespaceAware <code>true</code> if support for XML namespaces is to be provided
* @return the loaded {@link Document document} * @return the loaded {@link Document document}
* @throws Exception if an error occurs * @throws Exception if an error occurs
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -99,10 +99,10 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
/** Constants instance for this class */ /** Constants instance for this class */
private static final Constants constants = new Constants(XmlBeanDefinitionReader.class); private static final Constants constants = new Constants(XmlBeanDefinitionReader.class);
private boolean namespaceAware;
private int validationMode = VALIDATION_AUTO; private int validationMode = VALIDATION_AUTO;
private boolean namespaceAware = false;
private Class documentReaderClass = DefaultBeanDefinitionDocumentReader.class; private Class documentReaderClass = DefaultBeanDefinitionDocumentReader.class;
private ProblemReporter problemReporter = new FailFastProblemReporter(); private ProblemReporter problemReporter = new FailFastProblemReporter();
@ -135,21 +135,6 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
} }
/**
* Set whether or not the XML parser should be XML namespace aware.
* Default is "false".
*/
public void setNamespaceAware(boolean namespaceAware) {
this.namespaceAware = namespaceAware;
}
/**
* Return whether or not the XML parser should be XML namespace aware.
*/
public boolean isNamespaceAware() {
return this.namespaceAware;
}
/** /**
* Set the validation mode to use by name. Defaults to {@link #VALIDATION_AUTO}. * Set the validation mode to use by name. Defaults to {@link #VALIDATION_AUTO}.
*/ */
@ -172,56 +157,72 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
} }
/** /**
* Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use. Default implementation is * Set whether or not the XML parser should be XML namespace aware.
* {@link org.springframework.beans.factory.parsing.FailFastProblemReporter} which exhibits fail fast behaviour. External tools * Default is "false".
* can provide an alternative implementation that collates errors and warnings for */
* display in the tool UI. public void setNamespaceAware(boolean namespaceAware) {
this.namespaceAware = namespaceAware;
}
/**
* Return whether or not the XML parser should be XML namespace aware.
*/
public boolean isNamespaceAware() {
return this.namespaceAware;
}
/**
* Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use.
* <p>The default implementation is {@link org.springframework.beans.factory.parsing.FailFastProblemReporter}
* which exhibits fail fast behaviour. External tools can provide an alternative implementation
* that collates errors and warnings for display in the tool UI.
*/ */
public void setProblemReporter(ProblemReporter problemReporter) { public void setProblemReporter(ProblemReporter problemReporter) {
this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter()); this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
} }
/** /**
* Specify which {@link ReaderEventListener} to use. Default implementation is * Specify which {@link ReaderEventListener} to use.
* EmptyReaderEventListener which discards every event notification. External tools * <p>The default implementation is EmptyReaderEventListener which discards every event notification.
* can provide an alternative implementation to monitor the components being registered * External tools can provide an alternative implementation to monitor the components being
* in the BeanFactory. * registered in the BeanFactory.
*/ */
public void setEventListener(ReaderEventListener eventListener) { public void setEventListener(ReaderEventListener eventListener) {
this.eventListener = (eventListener != null ? eventListener : new EmptyReaderEventListener()); this.eventListener = (eventListener != null ? eventListener : new EmptyReaderEventListener());
} }
/** /**
* Specify the {@link SourceExtractor} to use. The default implementation is * Specify the {@link SourceExtractor} to use.
* {@link NullSourceExtractor} which simply returns <code>null</code> as the source object. * <p>The default implementation is {@link NullSourceExtractor} which simply returns <code>null</code>
* This means that during normal runtime execution no additional source metadata is attached * as the source object. This means that - during normal runtime execution -
* to the bean configuration metadata. * no additional source metadata is attached to the bean configuration metadata.
*/ */
public void setSourceExtractor(SourceExtractor sourceExtractor) { public void setSourceExtractor(SourceExtractor sourceExtractor) {
this.sourceExtractor = (sourceExtractor != null ? sourceExtractor : new NullSourceExtractor()); this.sourceExtractor = (sourceExtractor != null ? sourceExtractor : new NullSourceExtractor());
} }
/** /**
* Specify the {@link NamespaceHandlerResolver} to use. If none is specified a default * Specify the {@link NamespaceHandlerResolver} to use.
* instance will be created by {@link #createDefaultNamespaceHandlerResolver()}. * <p>If none is specified, a default instance will be created through
* {@link #createDefaultNamespaceHandlerResolver()}.
*/ */
public void setNamespaceHandlerResolver(NamespaceHandlerResolver namespaceHandlerResolver) { public void setNamespaceHandlerResolver(NamespaceHandlerResolver namespaceHandlerResolver) {
this.namespaceHandlerResolver = namespaceHandlerResolver; this.namespaceHandlerResolver = namespaceHandlerResolver;
} }
/** /**
* Specify the {@link DocumentLoader} to use. The default implementation is * Specify the {@link DocumentLoader} to use.
* {@link DefaultDocumentLoader} which loads {@link Document} instances using JAXP. * <p>The default implementation is {@link DefaultDocumentLoader}
* which loads {@link Document} instances using JAXP.
*/ */
public void setDocumentLoader(DocumentLoader documentLoader) { public void setDocumentLoader(DocumentLoader documentLoader) {
this.documentLoader = (documentLoader != null ? documentLoader : new DefaultDocumentLoader()); this.documentLoader = (documentLoader != null ? documentLoader : new DefaultDocumentLoader());
} }
/** /**
* Set a SAX entity resolver to be used for parsing. By default, * Set a SAX entity resolver to be used for parsing.
* BeansDtdResolver will be used. Can be overridden for custom entity * <p>By default, {@link ResourceEntityResolver} will be used. Can be overridden
* resolution, for example relative to some specific base path. * for custom entity resolution, for example relative to some specific base path.
* @see BeansDtdResolver
*/ */
public void setEntityResolver(EntityResolver entityResolver) { public void setEntityResolver(EntityResolver entityResolver) {
this.entityResolver = entityResolver; this.entityResolver = entityResolver;
@ -258,12 +259,10 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
} }
/** /**
* Specify the BeanDefinitionDocumentReader implementation to use, * Specify the {@link BeanDefinitionDocumentReader} implementation to use,
* responsible for the actual reading of the XML bean definition document. * responsible for the actual reading of the XML bean definition document.
* <p>Default is DefaultBeanDefinitionDocumentReader. * <p>The default is {@link DefaultBeanDefinitionDocumentReader}.
* @param documentReaderClass the desired BeanDefinitionDocumentReader implementation class * @param documentReaderClass the desired BeanDefinitionDocumentReader implementation class
* @see BeanDefinitionDocumentReader
* @see DefaultBeanDefinitionDocumentReader
*/ */
public void setDocumentReaderClass(Class documentReaderClass) { public void setDocumentReaderClass(Class documentReaderClass) {
if (documentReaderClass == null || !BeanDefinitionDocumentReader.class.isAssignableFrom(documentReaderClass)) { if (documentReaderClass == null || !BeanDefinitionDocumentReader.class.isAssignableFrom(documentReaderClass)) {