Class AnnotationHelper
java.lang.Object
com.github.victools.jsonschema.generator.AnnotationHelper
Helper class providing with standard mechanism to resolve annotations on annotated entities.
- Since:
- 4.37.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends Annotation>
Optional<A>resolveAnnotation(com.fasterxml.classmate.members.ResolvedMember<?> member, Class<A> annotationClass, Predicate<Annotation> metaAnnotationCheck) Resolves the specified annotation on the given resolved member and resolve nested annotations.static <A extends Annotation>
Optional<A>resolveAnnotation(AnnotatedElement annotatedElement, Class<A> annotationClass, Predicate<Annotation> metaAnnotationCheck) Select the instance of the specified annotation type from the given annotatedElement's annotations.static <A extends Annotation>
Optional<A>resolveAnnotation(List<Annotation> annotationList, Class<A> annotationClass, Predicate<Annotation> metaAnnotationCheck) Select the instance of the specified annotation type from the given list.
-
Method Details
-
resolveAnnotation
public static <A extends Annotation> Optional<A> resolveAnnotation(com.fasterxml.classmate.members.ResolvedMember<?> member, Class<A> annotationClass, Predicate<Annotation> metaAnnotationCheck) Resolves the specified annotation on the given resolved member and resolve nested annotations.- Type Parameters:
A- the generic type of the annotation- Parameters:
member- where to look for the specified annotationannotationClass- the class of the annotation to look formetaAnnotationCheck- the predicate indicating nested annotations- Returns:
- an empty entry if not found
-
resolveAnnotation
public static <A extends Annotation> Optional<A> resolveAnnotation(List<Annotation> annotationList, Class<A> annotationClass, Predicate<Annotation> metaAnnotationCheck) Select the instance of the specified annotation type from the given list.Also considering meta annotations (i.e., annotations on annotations) if a meta annotation is deemed eligible according to the given
Predicate.- Type Parameters:
A- the generic type of the annotation- Parameters:
annotationList- a list of annotations to look intoannotationClass- the class of the annotation to look formetaAnnotationCheck- the predicate indicating nested annotations- Returns:
- an empty entry if not found
-
resolveAnnotation
public static <A extends Annotation> Optional<A> resolveAnnotation(AnnotatedElement annotatedElement, Class<A> annotationClass, Predicate<Annotation> metaAnnotationCheck) Select the instance of the specified annotation type from the given annotatedElement's annotations.Also considering meta annotations (i.e., annotations on annotations) if a meta annotation is deemed eligible according to the given
metaAnnotationPredicate.- Type Parameters:
A- the generic type of the annotation- Parameters:
annotatedElement- where to look for the specified annotationannotationClass- the class of the annotation to look formetaAnnotationCheck- the predicate indicating meta annotations- Returns:
- an empty entry if not found
-