org.springframework.cache.interceptor

## Class DefaultKeyGenerator

- java.lang.Object
- - org.springframework.cache.interceptor.DefaultKeyGenerator

- All Implemented Interfaces:
    KeyGenerator

  Deprecated.
  as of Spring 4.0, in favor of `SimpleKeyGenerator` or custom `KeyGenerator` implementations based on hash codes

      @Deprecated
      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.

  NOTE: As this implementation returns only a hash of the parameters it is possible for key collisions to occur. Since Spring 4.0 the `SimpleKeyGenerator` is used when no explicit key generator has been defined. This class remains for applications that do not wish to migrate to the `SimpleKeyGenerator`.

  Since:
    3.1
  Author:
    Costin Leau, Chris Beams, Juergen Hoeller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `NO_PARAM_KEY` Deprecated.
    `static int` | `NULL_PARAM_KEY` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultKeyGenerator()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `generate(Object target, Method method, Object... params)` Deprecated. Generate a key for the given method and its parameters.

    - ### 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

      Deprecated.
      See Also:
        Constant Field Values

    - #### NULL_PARAM_KEY

          public static final int NULL_PARAM_KEY

      Deprecated.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultKeyGenerator

          public DefaultKeyGenerator()

      Deprecated.

  - ### Method Detail

    - #### generate

          public Object generate(Object target,
                                 Method method,
                                 Object... params)

      Deprecated.
      Description copied from interface: `KeyGenerator`
      Generate a key for the given method and its parameters.
      Specified by:
        `generate` in interface `KeyGenerator`
      Parameters:
        `target` - the target instance
        `method` - the method being called
        `params` - the method parameters (with any var-args expanded)
      Returns:
        a generated key