diff --git a/spring-context/src/main/java/org/springframework/cache/CacheManager.java b/spring-context/src/main/java/org/springframework/cache/CacheManager.java index 2f1c82ec45..205bc9a327 100644 --- a/spring-context/src/main/java/org/springframework/cache/CacheManager.java +++ b/spring-context/src/main/java/org/springframework/cache/CacheManager.java @@ -19,7 +19,8 @@ package org.springframework.cache; import java.util.Collection; /** - * A manager for a set of {@link Cache}s. + * Spring's central cache manager SPI. + * Allows for retrieving named {@link Cache} regions. * * @author Costin Leau * @since 3.1 @@ -28,14 +29,14 @@ public interface CacheManager { /** * Return the cache associated with the given name. - * @param name cache identifier (must not be {@code null}) - * @return the associated cache, or {@code null} if none is found + * @param name the cache identifier (must not be {@code null}) + * @return the associated cache, or {@code null} if none found */ Cache getCache(String name); /** - * Return a collection of the caches known by this cache manager. - * @return names of caches known by the cache manager + * Return a collection of the cache names known by this manager. + * @return the names of all caches known by the cache manager */ Collection getCacheNames(); diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java index 0a2c9c61c6..f8a6e3be4d 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -33,25 +33,28 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.method.HandlerMethodSelector; /** - * Discovers annotated exception handling methods in a given class type, including all - * super types, and helps to resolve an Exception to a method that can handle it. The - * exception types supported by a given method can also be discovered from the method - * signature. + * Discovers {@linkplain ExceptionHandler @ExceptionHandler} methods in a given class, + * including all of its superclasses, and helps to resolve a given {@link Exception} + * to the exception types supported by a given {@link Method}. * * @author Rossen Stoyanchev * @since 3.1 */ public class ExceptionHandlerMethodResolver { - /** A filter for selecting annotated exception handling methods. */ - public final static MethodFilter EXCEPTION_HANDLER_METHODS = new MethodFilter() { - + /** + * A filter for selecting {@code @ExceptionHandler} methods. + */ + public static final MethodFilter EXCEPTION_HANDLER_METHODS = new MethodFilter() { @Override public boolean matches(Method method) { return (AnnotationUtils.findAnnotation(method, ExceptionHandler.class) != null); } }; + /** + * Arbitrary {@link Method} reference, indicating no method found in the cache. + */ private static final Method NO_METHOD_FOUND = ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis"); @@ -116,26 +119,26 @@ public class ExceptionHandlerMethodResolver { } /** - * Find a method to handle the given exception. + * Find a {@link Method} to handle the given exception. * Use {@link ExceptionDepthComparator} if more than one match is found. * @param exception the exception - * @return a method to handle the exception or {@code null} + * @return a Method to handle the exception, or {@code null} if none found */ public Method resolveMethod(Exception exception) { return resolveMethodByExceptionType(exception.getClass()); } /** - * Find a method to handle the given exception type. This can be useful if - * an Exception instance is not available (example for tools). + * Find a {@link Method} to handle the given exception type. This can be + * useful if an {@link Exception} instance is not available (e.g. for tools). * @param exceptionType the exception type - * @return a method to handle the exception or {@code null} + * @return a Method to handle the exception, or {@code null} if none found */ public Method resolveMethodByExceptionType(Class exceptionType) { Method method = this.exceptionLookupCache.get(exceptionType); if (method == null) { method = getMappedMethod(exceptionType); - this.exceptionLookupCache.put(exceptionType, method != null ? method : NO_METHOD_FOUND); + this.exceptionLookupCache.put(exceptionType, (method != null ? method : NO_METHOD_FOUND)); } return method != NO_METHOD_FOUND ? method : null; } @@ -152,7 +155,7 @@ public class ExceptionHandlerMethodResolver { } if (!matches.isEmpty()) { Collections.sort(matches, new ExceptionDepthComparator(exceptionType)); - return mappedMethods.get(matches.get(0)); + return this.mappedMethods.get(matches.get(0)); } else { return null; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java index bab1be30de..684d239091 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java @@ -226,9 +226,9 @@ public final class ProducesRequestCondition extends AbstractRequestCondition