Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -54,7 +54,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link CacheManager} that this instance use.
|
||||
* Return the {@link CacheManager} that this instance uses.
|
||||
*/
|
||||
public CacheManager getCacheManager() {
|
||||
return this.cacheManager;
|
||||
@@ -62,7 +62,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.cacheManager, "CacheManager must not be null");
|
||||
Assert.notNull(this.cacheManager, "CacheManager is required");
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||
else {
|
||||
Collection<Cache> result = new ArrayList<Cache>();
|
||||
for (String cacheName : cacheNames) {
|
||||
Cache cache = this.cacheManager.getCache(cacheName);
|
||||
Cache cache = getCacheManager().getCache(cacheName);
|
||||
if (cache == null) {
|
||||
throw new IllegalArgumentException("Cannot find cache named '" +
|
||||
cacheName + "' for " + context.getOperation());
|
||||
@@ -91,7 +91,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||
* <p>It is acceptable to return {@code null} to indicate that no cache could
|
||||
* be resolved for this invocation.
|
||||
* @param context the context of the particular invocation
|
||||
* @return the cache name(s) to resolve or {@code null} if no cache should be resolved
|
||||
* @return the cache name(s) to resolve, or {@code null} if no cache should be resolved
|
||||
*/
|
||||
protected abstract Collection<String> getCacheNames(CacheOperationInvocationContext<?> context);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.cache.interceptor;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -34,13 +33,15 @@ public class NamedCacheResolver extends AbstractCacheResolver {
|
||||
|
||||
private Collection<String> cacheNames;
|
||||
|
||||
|
||||
public NamedCacheResolver() {
|
||||
}
|
||||
|
||||
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames) {
|
||||
super(cacheManager);
|
||||
this.cacheNames = new ArrayList<String>(Arrays.asList(cacheNames));
|
||||
}
|
||||
|
||||
public NamedCacheResolver() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cache name(s) that this resolver should use.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.support;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.springframework.cache.Cache;
|
||||
|
||||
@@ -29,7 +30,7 @@ import org.springframework.cache.Cache;
|
||||
*/
|
||||
public class SimpleCacheManager extends AbstractCacheManager {
|
||||
|
||||
private Collection<? extends Cache> caches;
|
||||
private Collection<? extends Cache> caches = Collections.emptySet();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -51,7 +51,9 @@ public class TypeMismatchNamingException extends NamingException {
|
||||
/**
|
||||
* Construct a new TypeMismatchNamingException.
|
||||
* @param explanation the explanation text
|
||||
* @deprecated as of Spring Framework 4.3.10
|
||||
*/
|
||||
@Deprecated
|
||||
public TypeMismatchNamingException(String explanation) {
|
||||
super(explanation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user