Top Description Methods
org.aspectj.weaver.tools.cache

public Interface CacheKeyResolver

Known Direct Implementers
org.aspectj.weaver.tools.cache.DefaultCacheKeyResolver
Imports
java.util.List

Interface to allow alternate hashing schemes for weaved and generated classes. While the DefaultCacheKeyResolver may be a reasonable naive implementation, the management and invalidation of the cache may be more usefully accomplished at the Application or Container level.

The key is not a one-way hash; it must be convertible back to a className and must match the regex for the type of key it is (generated or weaved).

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

scope, or null, if no caching should be performed for this classloader
createClassLoaderScope
(ClassLoader
Classloader for this adapter
loader
,
List<String>
list of aspects; either urls or class names handled by this adapter
aspects
)

Create a unique string for the given classpath and aspect list

public CachedClassReference

Returns:

key for the class, or null if no caching should be performed
generatedKey
(String
class to create a key for
className
)

Create a key for the given className from a class generated by the weaver such that:

   className == keyToClass(generatedKey(className)) holds
and
   generatedKey(className).matches(getGeneratedRegex()) == true
public String

Returns:

string regex
getGeneratedRegex
()

Return a regex which matches all generated keys

public String

Returns:

string regex
getWeavedRegex
()

Return a regex which matches all weaved keys;

public String

Returns:

className
keyToClass
(String
cache key
key
)

Convert a key back to a className

public CachedClassReference

Returns:

key for the class, or null if no caching should be performed
weavedKey
(String
class to create a key for
className
,
byte[]
bytes of the pre-weaved class
original_bytes
)

Create a key for the given class name and byte array from the pre-weaved class such that

   className == keyToClass(weavedKey(className, various_bytes)) holds
and
   weavedKey(className, various_bytes).matches(getWeavedRegex()) == true

Method Detail

createClassLoaderScopeback to summary
public String createClassLoaderScope(ClassLoader loader, List<String> aspects)

Create a unique string for the given classpath and aspect list

Parameters
loader:ClassLoader

Classloader for this adapter

aspects:List<String>

list of aspects; either urls or class names handled by this adapter

Returns:String

scope, or null, if no caching should be performed for this classloader

generatedKeyback to summary
public CachedClassReference generatedKey(String className)

Create a key for the given className from a class generated by the weaver such that:

   className == keyToClass(generatedKey(className)) holds
and
   generatedKey(className).matches(getGeneratedRegex()) == true
Parameters
className:String

class to create a key for

Returns:CachedClassReference

key for the class, or null if no caching should be performed

getGeneratedRegexback to summary
public String getGeneratedRegex()

Return a regex which matches all generated keys

Returns:String

string regex

getWeavedRegexback to summary
public String getWeavedRegex()

Return a regex which matches all weaved keys;

Returns:String

string regex

keyToClassback to summary
public String keyToClass(String key)

Convert a key back to a className

Parameters
key:String

cache key

Returns:String

className

weavedKeyback to summary
public CachedClassReference weavedKey(String className, byte[] original_bytes)

Create a key for the given class name and byte array from the pre-weaved class such that

   className == keyToClass(weavedKey(className, various_bytes)) holds
and
   weavedKey(className, various_bytes).matches(getWeavedRegex()) == true
Parameters
className:String

class to create a key for

original_bytes:byte[]

bytes of the pre-weaved class

Returns:CachedClassReference

key for the class, or null if no caching should be performed