[SPR-8388] Improved documentation on default registered PropertyEditors; fixed typos and grammar in JavaDoc; suppressed warnings due to generics; etc.

This commit is contained in:
Sam Brannen
2011-06-01 20:54:48 +00:00
parent 4642cca893
commit 919b996027
4 changed files with 53 additions and 52 deletions

View File

@@ -84,8 +84,8 @@ import org.springframework.util.StringUtils;
* "<code>zip:</code>" in WebLogic, "<code>wsjar</code>" in WebSphere", etc.),
* then a <code>java.io.File</code> is obtained from it, and used to resolve the
* wildcard by walking the filesystem. In the case of a jar URL, the resolver
* either gets a <code>java.net.JarURLConnection</code> from it, or manually parse
* the jar URL, and then traverse the contents of the jar file, to resolve the
* either gets a <code>java.net.JarURLConnection</code> from it, or manually parses
* the jar URL, and then traverses the contents of the jar file, to resolve the
* wildcards.
*
* <p><b>Implications on portability:</b>
@@ -173,7 +173,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
static {
// Detect Equinox OSGi (e.g. on WebSphere 6.1)
try {
Class fileLocatorClass = PathMatchingResourcePatternResolver.class.getClassLoader().loadClass(
Class<?> fileLocatorClass = PathMatchingResourcePatternResolver.class.getClassLoader().loadClass(
"org.eclipse.core.runtime.FileLocator");
equinoxResolveMethod = fileLocatorClass.getMethod("resolve", URL.class);
logger.debug("Found Equinox FileLocator for OSGi bundle URL resolution");
@@ -220,7 +220,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
this.resourceLoader = resourceLoader;
}
/**
* Return the ResourceLoader that this pattern resolver works with.
*/
@@ -286,7 +285,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
}
}
/**
* Find all class location resources with the given location via the ClassLoader.
* @param location the absolute path within the classpath
@@ -300,10 +298,10 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
if (path.startsWith("/")) {
path = path.substring(1);
}
Enumeration resourceUrls = getClassLoader().getResources(path);
Enumeration<URL> resourceUrls = getClassLoader().getResources(path);
Set<Resource> result = new LinkedHashSet<Resource>(16);
while (resourceUrls.hasMoreElements()) {
URL url = (URL) resourceUrls.nextElement();
URL url = resourceUrls.nextElement();
result.add(convertClassLoaderURL(url));
}
return result.toArray(new Resource[result.size()]);
@@ -384,7 +382,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
* <p>The default implementation detects an Equinox OSGi "bundleresource:"
* / "bundleentry:" URL and resolves it into a standard jar file URL that
* can be traversed using Spring's standard jar file traversal algorithm.
* @param original the resource to resolfe
* @param original the resource to resolve
* @return the resolved resource (may be identical to the passed-in resource)
* @throws IOException in case of resolution failure
*/
@@ -471,8 +469,8 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
rootEntryPath = rootEntryPath + "/";
}
Set<Resource> result = new LinkedHashSet<Resource>(8);
for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = (JarEntry) entries.nextElement();
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = entries.nextElement();
String entryPath = entry.getName();
if (entryPath.startsWith(rootEntryPath)) {
String relativePath = entryPath.substring(rootEntryPath.length());
@@ -604,7 +602,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
* Recursively retrieve files that match the given pattern,
* adding them to the given result list.
* @param fullPattern the pattern to match against,
* with preprended root directory path
* with prepended root directory path
* @param dir the current directory
* @param result the Set of matching File instances to add to
* @throws IOException if directory contents could not be retrieved
@@ -712,11 +710,11 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
return VfsPatternUtils.getVisitorAttribute();
}
public Set<Resource> getResources() {
return this.resources;
}
@SuppressWarnings("unused")
public int size() {
return this.resources.size();
}

View File

@@ -37,9 +37,9 @@ import org.springframework.core.io.Resource;
* to <code>Resource</code> array properties. Can also translate a collection
* or array of location patterns into a merged Resource array.
*
* <p>The path may contain <code>${...}</code> placeholders,
* to be resolved as system properties: e.g. <code>${user.dir}</code>.
* Unresolvable placeholder are ignored by default.
* <p>A path may contain <code>${...}</code> placeholders, to be
* resolved as {@link org.springframework.core.env.Environment} properties:
* e.g. <code>${user.dir}</code>. Unresolvable placeholders are ignored by default.
*
* <p>Delegates to a {@link ResourcePatternResolver},
* by default using a {@link PathMatchingResourcePatternResolver}.
@@ -123,7 +123,7 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport {
/**
* Treat the given text as location pattern and convert it to a Resource array.
* Treat the given text as a location pattern and convert it to a Resource array.
*/
@Override
public void setAsText(String text) {
@@ -138,13 +138,13 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport {
}
/**
* Treat the given value as collection or array and convert it to a Resource array.
* Considers String elements as location patterns, and takes Resource elements as-is.
* Treat the given value as a collection or array and convert it to a Resource array.
* Considers String elements as location patterns and takes Resource elements as-is.
*/
@Override
public void setValue(Object value) throws IllegalArgumentException {
if (value instanceof Collection || (value instanceof Object[] && !(value instanceof Resource[]))) {
Collection input = (value instanceof Collection ? (Collection) value : Arrays.asList((Object[]) value));
Collection<?> input = (value instanceof Collection ? (Collection<?>) value : Arrays.asList((Object[]) value));
List<Resource> merged = new ArrayList<Resource>();
for (Object element : input) {
if (element instanceof String) {