Polishing

(cherry picked from commit e670f4e)
This commit is contained in:
Juergen Hoeller 2014-01-15 17:45:04 +01:00
parent b6362c5016
commit 52c11eab41
3 changed files with 10 additions and 12 deletions

View File

@ -76,7 +76,7 @@ public class CachedIntrospectionResults {
* mode when calling the JavaBeans {@link Introspector}: "spring.beaninfo.ignore", with a * mode when calling the JavaBeans {@link Introspector}: "spring.beaninfo.ignore", with a
* value of "true" skipping the search for {@code BeanInfo} classes (typically for scenarios * value of "true" skipping the search for {@code BeanInfo} classes (typically for scenarios
* where no such classes are being defined for beans in the application in the first place). * where no such classes are being defined for beans in the application in the first place).
* <p>Default is "false", considering all {@code BeanInfo} metadata classes, like for * <p>The default is "false", considering all {@code BeanInfo} metadata classes, like for
* standard {@link Introspector#getBeanInfo(Class)} calls. Consider switching this flag to * standard {@link Introspector#getBeanInfo(Class)} calls. Consider switching this flag to
* "true" if you experience repeated ClassLoader access for non-existing {@code BeanInfo} * "true" if you experience repeated ClassLoader access for non-existing {@code BeanInfo}
* classes, in case such access is expensive on startup or on lazy loading. * classes, in case such access is expensive on startup or on lazy loading.

View File

@ -40,7 +40,7 @@ import org.springframework.util.Assert;
abstract class ReadOnlySystemAttributesMap implements Map<String, String> { abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
public boolean containsKey(Object key) { public boolean containsKey(Object key) {
return get(key) != null; return (get(key) != null);
} }
/** /**
@ -49,9 +49,7 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
*/ */
public String get(Object key) { public String get(Object key) {
Assert.isInstanceOf(String.class, key, Assert.isInstanceOf(String.class, key,
String.format("expected key [%s] to be of type String, got %s", String.format("Expected key [%s] to be of type String, got %s", key, key.getClass().getName()));
key, key.getClass().getName()));
return this.getSystemAttribute((String) key); return this.getSystemAttribute((String) key);
} }
@ -61,11 +59,11 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
/** /**
* Template method that returns the underlying system attribute. * Template method that returns the underlying system attribute.
*
* <p>Implementations typically call {@link System#getProperty(String)} or {@link System#getenv(String)} here. * <p>Implementations typically call {@link System#getProperty(String)} or {@link System#getenv(String)} here.
*/ */
protected abstract String getSystemAttribute(String attributeName); protected abstract String getSystemAttribute(String attributeName);
// Unsupported // Unsupported
public int size() { public int size() {
@ -92,7 +90,7 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
return Collections.emptySet(); return Collections.emptySet();
} }
public void putAll(Map<? extends String, ? extends String> m) { public void putAll(Map<? extends String, ? extends String> map) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -59,10 +59,10 @@ public abstract class ObjectUtils {
} }
/** /**
* Check whether the given exception is compatible with the exceptions * Check whether the given exception is compatible with the specified
* declared in a throws clause. * exception types, as declared in a throws clause.
* @param ex the exception to checked * @param ex the exception to check
* @param declaredExceptions the exceptions declared in the throws clause * @param declaredExceptions the exception types declared in the throws clause
* @return whether the given exception is compatible * @return whether the given exception is compatible
*/ */
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>... declaredExceptions) { public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>... declaredExceptions) {
@ -71,7 +71,7 @@ public abstract class ObjectUtils {
} }
if (declaredExceptions != null) { if (declaredExceptions != null) {
for (Class<?> declaredException : declaredExceptions) { for (Class<?> declaredException : declaredExceptions) {
if (declaredException.isAssignableFrom(ex.getClass())) { if (declaredException.isInstance(ex)) {
return true; return true;
} }
} }