Package play.libs

Class AnnotationUtils

java.lang.Object
play.libs.AnnotationUtils

public class AnnotationUtils extends Object
Annotation utilities.
  • Constructor Details

    • AnnotationUtils

      public AnnotationUtils()
  • Method Details

    • unwrapContainerAnnotations

      public static <A extends Annotation> Annotation[] unwrapContainerAnnotations(A[] annotations)
      Returns a new array whose entries do not contain container annotations anymore but the indirectly present annotation(s) a container annotation was wrapping instead. An annotation is considered a container annotation if its indirectly present annotation(s) are annotated with Repeatable. Annotations inside the given array which don't meet the above definition of a container annotations will be returned untouched.
      Parameters:
      annotations - An array of annotations to unwrap. Can contain both container and non container annotations.
      Returns:
      A new array without container annotations but the container annotations' indirectly defined annotations.
    • getIndirectlyPresentAnnotations

      public static <A extends Annotation> List<Annotation> getIndirectlyPresentAnnotations(A maybeContainerAnnotation)
      If the return type of an existing value() method of the passed annotation is an Annotation[] array and the annotations inside that Annotation[] array are annotated with the Repeatable annotation the annotations of that array will be returned. If the passed annotation does not have a value() method or the above criteria are not met an empty list will be returned instead.
      Parameters:
      maybeContainerAnnotation - The annotation which value() method will be checked for other annotations
      Returns:
      The annotations defined by the value() method or an empty list.