Class Annotations

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.lang.annotation.Annotation>

    public class Annotations
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Iterable<java.lang.annotation.Annotation>
    Container class used for storing set of annotations resolved for types (classes) as members (methods, fields, constructors).
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.LinkedHashMap<java.lang.Class<? extends java.lang.annotation.Annotation>,​java.lang.annotation.Annotation> _annotations  
      private java.lang.annotation.Annotation[] NO_ANNOTATIONS  
    • Constructor Summary

      Constructors 
      Constructor Description
      Annotations()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.annotation.Annotation override)
      Method for adding specified annotation, overriding existing value for the annotation type.
      void addAll​(Annotations overrides)
      Method for adding all annotations from specified set, as overrides to annotations this set has
      void addAsDefault​(java.lang.annotation.Annotation defValue)
      Method for adding specified annotation if and only if no value exists for the annotation type.
      java.lang.annotation.Annotation[] asArray()  
      java.util.List<java.lang.annotation.Annotation> asList()  
      <A extends java.lang.annotation.Annotation>
      A
      get​(java.lang.Class<A> cls)  
      java.util.Iterator<java.lang.annotation.Annotation> iterator()  
      int size()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • NO_ANNOTATIONS

        private final java.lang.annotation.Annotation[] NO_ANNOTATIONS
      • _annotations

        protected java.util.LinkedHashMap<java.lang.Class<? extends java.lang.annotation.Annotation>,​java.lang.annotation.Annotation> _annotations
    • Constructor Detail

      • Annotations

        public Annotations()
    • Method Detail

      • add

        public void add​(java.lang.annotation.Annotation override)
        Method for adding specified annotation, overriding existing value for the annotation type.
      • addAll

        public void addAll​(Annotations overrides)
        Method for adding all annotations from specified set, as overrides to annotations this set has
      • addAsDefault

        public void addAsDefault​(java.lang.annotation.Annotation defValue)
        Method for adding specified annotation if and only if no value exists for the annotation type.
      • iterator

        public java.util.Iterator<java.lang.annotation.Annotation> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.annotation.Annotation>
      • size

        public int size()
      • get

        public <A extends java.lang.annotation.Annotation> A get​(java.lang.Class<A> cls)
      • asArray

        public java.lang.annotation.Annotation[] asArray()
        Since:
        1.1.1
      • asList

        public java.util.List<java.lang.annotation.Annotation> asList()
        Since:
        1.1.1
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object