org.javalid.core.cache
Class GenericAnnotationCache

java.lang.Object
  extended by org.javalid.core.cache.GenericAnnotationCache
All Implemented Interfaces:
java.io.Serializable

public class GenericAnnotationCache
extends java.lang.Object
implements java.io.Serializable

This class is the general cache used to store any annotation-related information for classes and is the direct entry point to this cache.

Since:
1.2
Version:
1.0
Author:
M.Reuvers
See Also:
Serialized Form

Constructor Summary
GenericAnnotationCache()
           
 
Method Summary
 void addAnnotationClassCache(java.lang.Class clazz, AnnotationClassCache cacheElement)
          Adds a new AnnotationClassCache cacheElement to the class cache.
 AnnotationClassCache getAnotationClassCache(java.lang.Class clazz)
          Returns AnnotationClassCache if found for given class, null if not found.
 boolean isClassInCache(java.lang.Class clazz)
          Returns true if given clazz is in cache (checks inheritance hierarchy), that is: Say a baseclass Person is stored, then subclass Creditor is also in cache (as it is a subclass).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericAnnotationCache

public GenericAnnotationCache()
Method Detail

isClassInCache

public boolean isClassInCache(java.lang.Class clazz)
Returns true if given clazz is in cache (checks inheritance hierarchy), that is: Say a baseclass Person is stored, then subclass Creditor is also in cache (as it is a subclass).

Parameters:
clazz - Class to check
Returns:
True if in cache, false otherwise.

getAnotationClassCache

public AnnotationClassCache getAnotationClassCache(java.lang.Class clazz)
Returns AnnotationClassCache if found for given class, null if not found.

Parameters:
clazz - The clazz to get cache for
Returns:
AnnotationClassCache if found, null otherwise.

addAnnotationClassCache

public void addAnnotationClassCache(java.lang.Class clazz,
                                    AnnotationClassCache cacheElement)
Adds a new AnnotationClassCache cacheElement to the class cache. If one already exists for this class, it is replaced. This part of code is synchronized to prevent multiple threads from accessing the cache at once while adding.

Parameters:
clazz - The class the cacheElement is for
cacheElement - The cacheElement