Class AnnotationList.AbstractBase

All Implemented Interfaces:
Iterable<AnnotationDescription>, Collection<AnnotationDescription>, List<AnnotationDescription>, SequencedCollection<AnnotationDescription>, AnnotationList, FilterableList<AnnotationDescription,AnnotationList>
Direct Known Subclasses:
AnnotationList.Explicit, AnnotationList.ForLoadedAnnotations
Enclosing interface:
AnnotationList

public abstract static class AnnotationList.AbstractBase extends FilterableList.AbstractBase<AnnotationDescription,AnnotationList> implements AnnotationList
An abstract base implementation of an annotation list.
  • Constructor Details

    • AbstractBase

      public AbstractBase()
  • Method Details

    • isAnnotationPresent

      public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
      Checks if this list contains an annotation of the given type.
      Specified by:
      isAnnotationPresent in interface AnnotationList
      Parameters:
      annotationType - The type to find in the list.
      Returns:
      true if the list contains the annotation type.
    • isAnnotationPresent

      public boolean isAnnotationPresent(TypeDescription annotationType)
      Checks if this list contains an annotation of the given type.
      Specified by:
      isAnnotationPresent in interface AnnotationList
      Parameters:
      annotationType - The type to find in the list.
      Returns:
      true if the list contains the annotation type.
    • ofType

      @MaybeNull public <T extends Annotation> AnnotationDescription.Loadable<T> ofType(Class<T> annotationType)
      Finds the first annotation of the given type and returns it.
      Specified by:
      ofType in interface AnnotationList
      Type Parameters:
      T - The annotation type.
      Parameters:
      annotationType - The type to be found in the list.
      Returns:
      The annotation description or null if no such annotation was found.
    • ofType

      @MaybeNull public AnnotationDescription ofType(TypeDescription annotationType)
      Finds the first annotation of the given type and returns it.
      Specified by:
      ofType in interface AnnotationList
      Parameters:
      annotationType - The type to be found in the list.
      Returns:
      The annotation description or null if no such annotation was found.
    • inherited

      public AnnotationList inherited(Set<? extends TypeDescription> ignoredTypes)
      Returns only annotations that are marked as Inherited as long as they are not contained by the set of ignored annotation types.
      Specified by:
      inherited in interface AnnotationList
      Parameters:
      ignoredTypes - A list of annotation types to be ignored from the lookup.
      Returns:
      A list of all inherited annotations besides of the given ignored types.
    • visibility

      public AnnotationList visibility(ElementMatcher<? super RetentionPolicy> matcher)
      Only retains annotations with the given retention policy.
      Specified by:
      visibility in interface AnnotationList
      Parameters:
      matcher - A matcher for the required retention policy.
      Returns:
      A of annotations only with elements
    • asTypeList

      public TypeList asTypeList()
      Returns a list of the annotation types of this list.
      Specified by:
      asTypeList in interface AnnotationList
      Returns:
      A list of the annotation types of this list.
    • wrap

      protected AnnotationList wrap(List<AnnotationDescription> values)
      Description copied from class: FilterableList.AbstractBase
      Represents a list of values as an instance of this instance's list type.
      Specified by:
      wrap in class FilterableList.AbstractBase<AnnotationDescription,AnnotationList>
      Parameters:
      values - The values to wrap in an instance of this list's type.
      Returns:
      A wrapped instance of the given values.