Rename KeyGenerator#extract => #generate

This commit is contained in:
Chris Beams 2011-11-16 04:20:57 +00:00
parent 06306f9149
commit f9879b762b
3 changed files with 5 additions and 4 deletions

View File

@ -453,7 +453,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
if (StringUtils.hasText(this.operation.getKey())) { if (StringUtils.hasText(this.operation.getKey())) {
return evaluator.key(this.operation.getKey(), this.method, this.evalContext); return evaluator.key(this.operation.getKey(), this.method, this.evalContext);
} }
return keyGenerator.extract(this.target, this.method, this.args); return keyGenerator.generate(this.target, this.method, this.args);
} }
protected Collection<Cache> getCaches() { protected Collection<Cache> getCaches() {

View File

@ -35,7 +35,7 @@ public class DefaultKeyGenerator implements KeyGenerator {
public static final int NO_PARAM_KEY = 0; public static final int NO_PARAM_KEY = 0;
public static final int NULL_PARAM_KEY = 53; public static final int NULL_PARAM_KEY = 53;
public Object extract(Object target, Method method, Object... params) { public Object generate(Object target, Method method, Object... params) {
if (params.length == 1) { if (params.length == 1) {
return (params[0] == null ? NULL_PARAM_KEY : params[0]); return (params[0] == null ? NULL_PARAM_KEY : params[0]);
} }

View File

@ -19,14 +19,15 @@ package org.springframework.cache.interceptor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
/** /**
* Cache 'key' extractor. Used for creating a key based on the given method * Cache key generator. Used for creating a key based on the given method
* (used as context) and its parameters. * (used as context) and its parameters.
* *
* @author Costin Leau * @author Costin Leau
* @author Chris Beams
* @since 3.1 * @since 3.1
*/ */
public interface KeyGenerator { public interface KeyGenerator {
Object extract(Object target, Method method, Object... params); Object generate(Object target, Method method, Object... params);
} }