org.jboss.ejb3.aop.annotation
Class CachingAnnotationRepository

java.lang.Object
  extended by org.jboss.aop.annotation.AnnotationRepository
      extended by org.jboss.ejb3.aop.annotation.CachingAnnotationRepository
All Implemented Interfaces:
org.jboss.ejb3.metadata.annotation.ExtendedAnnotationRepository

public class CachingAnnotationRepository
extends org.jboss.aop.annotation.AnnotationRepository
implements org.jboss.ejb3.metadata.annotation.ExtendedAnnotationRepository

Cache the results from an AnnotationRepository to get some speed out of the lookup. Note that this class is not thread safe. If one thread adds annotations while another reads there is no guarantee which result is returned. The following operation are not supported: - anything using javassist - querying for complete annotation maps


Field Summary
 
Fields inherited from class org.jboss.aop.annotation.AnnotationRepository
lazyCollectionLock
 
Constructor Summary
CachingAnnotationRepository(org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData delegate, java.lang.ClassLoader classLoader)
           
 
Method Summary
 void addAnnotation(javassist.CtMember m, java.lang.String annotation)
           
 void addAnnotation(java.lang.reflect.Member m, java.lang.Class annotation, java.lang.Object value)
           
 void addAnnotation(java.lang.reflect.Member m, java.lang.String annotation, java.lang.Object value)
           
 void addClassAnnotation(java.lang.Class annotationType, java.lang.Object value)
           
 void addClassAnnotation(java.lang.String annotation, java.lang.String value)
           
 void disableAnnotation(java.lang.reflect.Member m, java.lang.String annotation)
           
 void disableAnnotation(java.lang.String annotation)
           
 void enableAnnotation(java.lang.String annotation)
           
protected  java.util.Map<java.lang.Class<?>,java.lang.Object> getAnnotationCache(java.lang.reflect.Member m)
           
 java.util.Map getAnnotations()
           
 java.util.Map getClassAnnotations()
           
 boolean hasAnnotation(java.lang.Class<?> cls, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
           
 boolean hasAnnotation(java.lang.Class<?> cls, java.lang.reflect.Member member, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
           
 boolean hasAnnotation(javassist.CtMember m, java.lang.String annotation)
           
 boolean hasAnnotation(java.lang.reflect.Member m, java.lang.Class annotation)
           
 boolean hasAnnotation(java.lang.reflect.Member m, java.lang.String annotation)
           
 boolean hasClassAnnotation(java.lang.Class annotationType)
           
 boolean hasClassAnnotation(java.lang.String annotation)
           
protected  java.lang.annotation.Annotation initAnnotation(java.lang.Object annotation)
           
 boolean isDisabled(java.lang.Class annotation)
           
 boolean isDisabled(java.lang.reflect.Member m, java.lang.Class annotation)
           
 boolean isDisabled(java.lang.reflect.Member m, java.lang.String annotation)
           
 boolean isDisabled(java.lang.String annotation)
           
protected  java.lang.Class<?> loadClass(java.lang.String className)
           
<A extends java.lang.annotation.Annotation>
A
resolveAnnotation(java.lang.Class<?> cls, java.lang.Class<A> annotationType)
           
<A extends java.lang.annotation.Annotation>
A
resolveAnnotation(java.lang.Class<?> cls, java.lang.reflect.Member member, java.lang.Class<A> annotationType)
           
 java.lang.Object resolveAnnotation(java.lang.reflect.Member m, java.lang.Class annotationType)
           
protected  java.lang.Object resolveAnnotation(java.lang.reflect.Member m, java.lang.String annotation)
           
 java.lang.Object resolveClassAnnotation(java.lang.Class annotationType)
           
 
Methods inherited from class org.jboss.aop.annotation.AnnotationRepository
extractAnnotation, initAnnotationsMap, initClassAnnotationsMap, initDisabledAnnotationsMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingAnnotationRepository

public CachingAnnotationRepository(org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData delegate,
                                   java.lang.ClassLoader classLoader)
Method Detail

addAnnotation

public void addAnnotation(javassist.CtMember m,
                          java.lang.String annotation)
Overrides:
addAnnotation in class org.jboss.aop.annotation.AnnotationRepository

addAnnotation

public void addAnnotation(java.lang.reflect.Member m,
                          java.lang.String annotation,
                          java.lang.Object value)
Overrides:
addAnnotation in class org.jboss.aop.annotation.AnnotationRepository

addAnnotation

public void addAnnotation(java.lang.reflect.Member m,
                          java.lang.Class annotation,
                          java.lang.Object value)
Overrides:
addAnnotation in class org.jboss.aop.annotation.AnnotationRepository

addClassAnnotation

public void addClassAnnotation(java.lang.Class annotationType,
                               java.lang.Object value)
Overrides:
addClassAnnotation in class org.jboss.aop.annotation.AnnotationRepository

addClassAnnotation

public void addClassAnnotation(java.lang.String annotation,
                               java.lang.String value)
Overrides:
addClassAnnotation in class org.jboss.aop.annotation.AnnotationRepository

disableAnnotation

public void disableAnnotation(java.lang.reflect.Member m,
                              java.lang.String annotation)
Overrides:
disableAnnotation in class org.jboss.aop.annotation.AnnotationRepository

disableAnnotation

public void disableAnnotation(java.lang.String annotation)
Overrides:
disableAnnotation in class org.jboss.aop.annotation.AnnotationRepository

enableAnnotation

public void enableAnnotation(java.lang.String annotation)
Overrides:
enableAnnotation in class org.jboss.aop.annotation.AnnotationRepository

getAnnotationCache

protected java.util.Map<java.lang.Class<?>,java.lang.Object> getAnnotationCache(java.lang.reflect.Member m)

getAnnotations

public java.util.Map getAnnotations()
Overrides:
getAnnotations in class org.jboss.aop.annotation.AnnotationRepository

getClassAnnotations

public java.util.Map getClassAnnotations()
Overrides:
getClassAnnotations in class org.jboss.aop.annotation.AnnotationRepository

hasAnnotation

public boolean hasAnnotation(java.lang.Class<?> cls,
                             java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Specified by:
hasAnnotation in interface org.jboss.ejb3.metadata.annotation.ExtendedAnnotationRepository

hasAnnotation

public boolean hasAnnotation(java.lang.Class<?> cls,
                             java.lang.reflect.Member member,
                             java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Specified by:
hasAnnotation in interface org.jboss.ejb3.metadata.annotation.ExtendedAnnotationRepository

hasAnnotation

public boolean hasAnnotation(javassist.CtMember m,
                             java.lang.String annotation)
Overrides:
hasAnnotation in class org.jboss.aop.annotation.AnnotationRepository

hasAnnotation

public boolean hasAnnotation(java.lang.reflect.Member m,
                             java.lang.Class annotation)
Overrides:
hasAnnotation in class org.jboss.aop.annotation.AnnotationRepository

hasAnnotation

public boolean hasAnnotation(java.lang.reflect.Member m,
                             java.lang.String annotation)
Overrides:
hasAnnotation in class org.jboss.aop.annotation.AnnotationRepository

hasClassAnnotation

public boolean hasClassAnnotation(java.lang.Class annotationType)
Overrides:
hasClassAnnotation in class org.jboss.aop.annotation.AnnotationRepository

hasClassAnnotation

public boolean hasClassAnnotation(java.lang.String annotation)
Overrides:
hasClassAnnotation in class org.jboss.aop.annotation.AnnotationRepository

initAnnotation

protected java.lang.annotation.Annotation initAnnotation(java.lang.Object annotation)

isDisabled

public boolean isDisabled(java.lang.Class annotation)
Overrides:
isDisabled in class org.jboss.aop.annotation.AnnotationRepository

isDisabled

public boolean isDisabled(java.lang.reflect.Member m,
                          java.lang.Class annotation)
Overrides:
isDisabled in class org.jboss.aop.annotation.AnnotationRepository

isDisabled

public boolean isDisabled(java.lang.reflect.Member m,
                          java.lang.String annotation)
Overrides:
isDisabled in class org.jboss.aop.annotation.AnnotationRepository

isDisabled

public boolean isDisabled(java.lang.String annotation)
Overrides:
isDisabled in class org.jboss.aop.annotation.AnnotationRepository

loadClass

protected java.lang.Class<?> loadClass(java.lang.String className)

resolveAnnotation

public <A extends java.lang.annotation.Annotation> A resolveAnnotation(java.lang.Class<?> cls,
                                                                       java.lang.Class<A> annotationType)
Specified by:
resolveAnnotation in interface org.jboss.ejb3.metadata.annotation.ExtendedAnnotationRepository

resolveAnnotation

public <A extends java.lang.annotation.Annotation> A resolveAnnotation(java.lang.Class<?> cls,
                                                                       java.lang.reflect.Member member,
                                                                       java.lang.Class<A> annotationType)
Specified by:
resolveAnnotation in interface org.jboss.ejb3.metadata.annotation.ExtendedAnnotationRepository

resolveAnnotation

public java.lang.Object resolveAnnotation(java.lang.reflect.Member m,
                                          java.lang.Class annotationType)
Overrides:
resolveAnnotation in class org.jboss.aop.annotation.AnnotationRepository

resolveAnnotation

protected java.lang.Object resolveAnnotation(java.lang.reflect.Member m,
                                             java.lang.String annotation)
Overrides:
resolveAnnotation in class org.jboss.aop.annotation.AnnotationRepository

resolveClassAnnotation

public java.lang.Object resolveClassAnnotation(java.lang.Class annotationType)
Overrides:
resolveClassAnnotation in class org.jboss.aop.annotation.AnnotationRepository