Class Annotations

    • Constructor Detail

      • Annotations

        public Annotations()
        Creates a new Annotations object.
    • Method Detail

      • set

        public <T extends IAnnotation> void set​(T annotation)
        Sets an annotation.
        Type Parameters:
        T - the annotation type.
        Parameters:
        annotation - The annotation object to set.
      • get

        public <A extends IAnnotation> A get​(Class<A> annotationType)
        Gets the annotation for a given type.
        Type Parameters:
        A - the annotation type
        Parameters:
        annotationType - Type of the annotation to retrieve.
        Returns:
        The found annotation, or null if no annotation of the given type was found.
      • clear

        public void clear()
        Removes all the annotations in this object.
      • remove

        public <A extends IAnnotation> A remove​(Class<A> annotationType)
        Removes the annotation of a given type.
        Type Parameters:
        A - the annotation type
        Parameters:
        annotationType - Type of the annotation to remove.
        Returns:
        The removed annotation, or null if no annotation of the given type was found.
      • clone

        public Annotations clone()
        Clones this Annotations object.

        Important: the annotations themselves are not cloned, only the map holding them is new.

        Overrides:
        clone in class Object
        Returns:
        the cloned object.
      • isEmpty

        public boolean isEmpty()