@NotThreadSafe public class AnnotationUsageCache extends Object
Cache because it would need
a Class<?> as a key and this would be a hard wired
reference.| Constructor and Description |
|---|
AnnotationUsageCache(Class<? extends Annotation> aAnnotationClass)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Remove all entries from the cache.
|
Class<? extends Annotation> |
getAnnotationClass() |
boolean |
hasAnnotation(Class<?> aClass)
Check if the provided class has the annotation from the constructor or not.
|
boolean |
hasAnnotation(Object aObject)
Check if the class of the passed object has the annotation provided in the
constructor.
|
void |
setAnnotation(Class<?> aClass,
boolean bHasAnnotation)
In case the knowledge was gathered on the outside, remember the wisdom in
this class.
|
String |
toString() |
public AnnotationUsageCache(@Nonnull Class<? extends Annotation> aAnnotationClass)
aAnnotationClass - The annotation class to store the existence of. It must have the
RetentionPolicy.RUNTIME to be usable within this class!@Nonnull public final Class<? extends Annotation> getAnnotationClass()
null.public boolean hasAnnotation(@Nonnull Object aObject)
aObject - The object. To be checked. May not be null.true if the owning class has the annotation,
false if not.hasAnnotation(Class)public boolean hasAnnotation(@Nonnull Class<?> aClass)
aClass - The class to check. May not be null.true if the provided class has the annotation,
false if not.public void setAnnotation(@Nonnull Class<?> aClass, boolean bHasAnnotation)
aClass - The class that it is about.bHasAnnotation - true to indicate the presence, false topublic void clearCache()
Copyright © 2014–2022 Philip Helger. All rights reserved.