com.googlecode.ehcache.annotations.key
Class StringCacheKeyGenerator

java.lang.Object
  extended by com.googlecode.ehcache.annotations.key.AbstractCacheKeyGenerator<T>
      extended by com.googlecode.ehcache.annotations.key.AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>
          extended by com.googlecode.ehcache.annotations.key.StringCacheKeyGenerator
All Implemented Interfaces:
CacheKeyGenerator<java.lang.String>, ReflectionHelperAware

public class StringCacheKeyGenerator
extends AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

Version:
$Revision: 656 $
Author:
Eric Dalquist

Nested Class Summary
static class StringCacheKeyGenerator.StringGenerator
           
 
Field Summary
static java.lang.String DEFAULT_BEAN_NAME
          Name of the bean this generator is registered under using the default constructor.
 
Constructor Summary
StringCacheKeyGenerator()
           
StringCacheKeyGenerator(boolean includeMethod, boolean includeParameterTypes)
           
 
Method Summary
protected  void append(StringCacheKeyGenerator.StringGenerator generator, boolean[] a)
          Append a boolean array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, byte[] a)
          Append a byte array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, char[] a)
          Append a char array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, double[] a)
          Append a double array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, float[] a)
          Append a float array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, int[] a)
          Append a int array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, long[] a)
          Append a long array.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, java.lang.Object e)
          Append an object to the key.
protected  void append(StringCacheKeyGenerator.StringGenerator generator, short[] a)
          Append a short array.
protected  void appendGraphCycle(StringCacheKeyGenerator.StringGenerator generator, java.lang.Object o)
          Called if a graph cycle is detected.
protected  void appendNull(StringCacheKeyGenerator.StringGenerator generator)
          Called if a null value is found in the object graph
protected  void beginRecursion(StringCacheKeyGenerator.StringGenerator generator, java.lang.Object e)
          Called before each array/Iterable/Map is handled.
protected  void endRecursion(StringCacheKeyGenerator.StringGenerator generator, java.lang.Object e)
          Called after each array/Iterable/Map is handled.
protected  java.lang.String generateKey(StringCacheKeyGenerator.StringGenerator generator)
          Generate the cache key from the generator
protected  StringCacheKeyGenerator.StringGenerator getGenerator(java.lang.Object... data)
          Create the object used to generate the key.
protected  boolean shouldReflect(java.lang.Object element)
          Default implementation returns true if the Object doesn't implement hashCode or doesn't implement equals.
 
Methods inherited from class com.googlecode.ehcache.annotations.key.AbstractDeepCacheKeyGenerator
deepHashCode, deepHashCode, deepHashCode, deepHashCode, generateKey, getReflectionHelper, isUseReflection, reflectionDeepHashCode, setReflectionHelper, setUseReflection, toString
 
Methods inherited from class com.googlecode.ehcache.annotations.key.AbstractCacheKeyGenerator
generateKey, isCheckforCycles, isIncludeMethod, isIncludeParameterTypes, register, setCheckforCycles, setIncludeMethod, setIncludeParameterTypes, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BEAN_NAME

public static final java.lang.String DEFAULT_BEAN_NAME
Name of the bean this generator is registered under using the default constructor.

See Also:
Constant Field Values
Constructor Detail

StringCacheKeyGenerator

public StringCacheKeyGenerator()
See Also:
AbstractCacheKeyGenerator.AbstractCacheKeyGenerator()

StringCacheKeyGenerator

public StringCacheKeyGenerator(boolean includeMethod,
                               boolean includeParameterTypes)
See Also:
AbstractCacheKeyGenerator.AbstractCacheKeyGenerator(boolean, boolean)
Method Detail

getGenerator

protected StringCacheKeyGenerator.StringGenerator getGenerator(java.lang.Object... data)
Description copied from class: AbstractDeepCacheKeyGenerator
Create the object used to generate the key. This object is passed into every AbstractDeepCacheKeyGenerator.deepHashCode(G, java.lang.Object[]) and AbstractDeepCacheKeyGenerator.append(G, java.lang.Object) call.

Specified by:
getGenerator in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

generateKey

protected java.lang.String generateKey(StringCacheKeyGenerator.StringGenerator generator)
Description copied from class: AbstractDeepCacheKeyGenerator
Generate the cache key from the generator

Specified by:
generateKey in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

beginRecursion

protected void beginRecursion(StringCacheKeyGenerator.StringGenerator generator,
                              java.lang.Object e)
Description copied from class: AbstractDeepCacheKeyGenerator
Called before each array/Iterable/Map is handled. Useful for sub-classes that want to be aware of the tree structure of the object graph.

Overrides:
beginRecursion in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

endRecursion

protected void endRecursion(StringCacheKeyGenerator.StringGenerator generator,
                            java.lang.Object e)
Description copied from class: AbstractDeepCacheKeyGenerator
Called after each array/Iterable/Map is handled. Useful for sub-classes that want to be aware of the tree structure of the object graph.

Overrides:
endRecursion in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      boolean[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a boolean array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle boolean or boolean array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      byte[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a byte array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle byte or byte array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      char[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a char array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle char or char array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      double[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a double array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle double or double array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      float[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a float array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle float or float array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      int[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a int array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle int or int array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      long[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a long array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle long or long array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      short[] a)
Description copied from class: AbstractDeepCacheKeyGenerator
Append a short array. Calls AbstractDeepCacheKeyGenerator.append(Object, Object) on each value in the array. If the implementing class can handle short or short array primitives directly this should be overridden to avoid auto-boxing each array element.

Overrides:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

append

protected void append(StringCacheKeyGenerator.StringGenerator generator,
                      java.lang.Object e)
Description copied from class: AbstractDeepCacheKeyGenerator
Append an object to the key.

Specified by:
append in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

appendGraphCycle

protected void appendGraphCycle(StringCacheKeyGenerator.StringGenerator generator,
                                java.lang.Object o)
Description copied from class: AbstractDeepCacheKeyGenerator
Called if a graph cycle is detected.

Specified by:
appendGraphCycle in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>
o - The object that started the cycle

appendNull

protected void appendNull(StringCacheKeyGenerator.StringGenerator generator)
Description copied from class: AbstractDeepCacheKeyGenerator
Called if a null value is found in the object graph

Specified by:
appendNull in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>

shouldReflect

protected boolean shouldReflect(java.lang.Object element)
Description copied from class: AbstractDeepCacheKeyGenerator
Default implementation returns true if the Object doesn't implement hashCode or doesn't implement equals.

Overrides:
shouldReflect in class AbstractDeepCacheKeyGenerator<StringCacheKeyGenerator.StringGenerator,java.lang.String>
Parameters:
element - will never be null


Copyright © 2011. All Rights Reserved.