org.springframework.cache.interceptor
Class DefaultKeyGenerator

java.lang.Object
  extended by org.springframework.cache.interceptor.DefaultKeyGenerator
All Implemented Interfaces:
KeyGenerator

public class DefaultKeyGenerator
extends Object
implements KeyGenerator

Default key generator. Returns 0 if no parameters are provided, the parameter itself if only one is given or a hash code computed from all given parameters' hash code values. Uses the constant value 53 for any null parameters given.

Since:
3.1
Author:
Costin Leau, Chris Beams

Field Summary
static int NO_PARAM_KEY
           
static int NULL_PARAM_KEY
           
 
Constructor Summary
DefaultKeyGenerator()
           
 
Method Summary
 Object generate(Object target, Method method, Object... params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PARAM_KEY

public static final int NO_PARAM_KEY
See Also:
Constant Field Values

NULL_PARAM_KEY

public static final int NULL_PARAM_KEY
See Also:
Constant Field Values
Constructor Detail

DefaultKeyGenerator

public DefaultKeyGenerator()
Method Detail

generate

public Object generate(Object target,
                       Method method,
                       Object... params)
Specified by:
generate in interface KeyGenerator