sf logo

sf.qof.util
Class ClassGenerationCache

java.lang.Object
  extended by sf.qof.util.ClassGenerationCache

public final class ClassGenerationCache
extends Object

Caches generated classes according to a specified key. ClassGenerationCache is thread-safe. Classes are cached separately for each class loader.


Method Summary
static Class<?> getCachedClass(Class<?>... key)
          Returns a cached class for a specified key.
static void putCachedClass(Class<?> clazz, Class<?>... key)
          Puts a class into the class cache specified by a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCachedClass

public static Class<?> getCachedClass(Class<?>... key)
Returns a cached class for a specified key. If no class can be found for the specified key null is returned and the key is marked for generation. If a key is marked for generation by another thread this method waits till the other thread completes generation.

Parameters:
key - key for the cached class
Returns:
the cached class or null if not found

putCachedClass

public static void putCachedClass(Class<?> clazz,
                                  Class<?>... key)
Puts a class into the class cache specified by a key. If the class is null the key is removed.

Parameters:
clazz - the cached class
key - the key

sf logo

Copyright © 2007 brunella ltd. All Rights Reserved.