Package play.libs
Class AnnotationUtils
- Object
-
- play.libs.AnnotationUtils
-
public class AnnotationUtils extends Object
Annotation utilities.
-
-
Constructor Summary
Constructors Constructor Description AnnotationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A extends Annotation>
List<Annotation>getIndirectlyPresentAnnotations(A maybeContainerAnnotation)
If the return type of an existingvalue()
method of the passed annotation is anAnnotation[]
array and the annotations inside thatAnnotation[]
array are annotated with theRepeatable
annotation the annotations of that array will be returned.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.
-
-
-
Method Detail
-
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 withRepeatable
. 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 existingvalue()
method of the passed annotation is anAnnotation[]
array and the annotations inside thatAnnotation[]
array are annotated with theRepeatable
annotation the annotations of that array will be returned. If the passed annotation does not have avalue()
method or the above criteria are not met an empty list will be returned instead.- Parameters:
maybeContainerAnnotation
- The annotation whichvalue()
method will be checked for other annotations- Returns:
- The annotations defined by the
value()
method or an empty list.
-
-