Class AnnotationUsageCache

  • All Implemented Interfaces:
    Serializable

    @ThreadSafe
    public class AnnotationUsageCache
    extends Object
    implements Serializable
    A simple cache for the usage of a certain annotation class at other classes.
    Note: cannot use Cache because it would need a Class<?> as a key and this would be a hard wired reference.
    Author:
    Philip Helger
    See Also:
    Serialized Form
    • Constructor Detail

      • AnnotationUsageCache

        public AnnotationUsageCache​(@Nonnull
                                    Class<? extends Annotation> aAnnotationClass)
        Constructor
        Parameters:
        aAnnotationClass - The annotation class to store the existence of. It must have the RetentionPolicy.RUNTIME to be usable within this class!
    • Method Detail

      • getAnnotationClass

        @Nonnull
        public final Class<? extends Annotation> getAnnotationClass()
        Returns:
        The annotation class passed in the constructor. Never null.
      • hasAnnotation

        public boolean hasAnnotation​(@Nonnull
                                     Object aObject)
      • hasAnnotation

        public boolean hasAnnotation​(@Nonnull
                                     Class<?> aClass)
      • setAnnotation

        public void setAnnotation​(@Nonnull
                                  Class<?> aClass,
                                  boolean bHasAnnotation)
      • clearCache

        public void clearCache()