Polishing

This commit is contained in:
Juergen Hoeller
2018-02-26 13:24:50 +01:00
parent 06e2bada0a
commit 0bc7c47bea
2 changed files with 13 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,8 @@ public abstract class AbstractValueAdaptingCache implements Cache {
public <T> T get(Object key, Class<T> type) {
Object value = fromStoreValue(lookup(key));
if (value != null && type != null && !type.isInstance(value)) {
throw new IllegalStateException("Cached value is not of required type [" + type.getName() + "]: " + value);
throw new IllegalStateException(
"Cached value is not of required type [" + type.getName() + "]: " + value);
}
return (T) value;
}
@@ -70,7 +71,7 @@ public abstract class AbstractValueAdaptingCache implements Cache {
/**
* Perform an actual lookup in the underlying store.
* @param key the key whose associated value is to be returned
* @return the raw store value for the key
* @return the raw store value for the key, or {@code null} if none
*/
protected abstract Object lookup(Object key);