public interface Annotations
| Modifier and Type | Method and Description |
|---|---|
Stream<Annotation> |
all()
Get all
Annotation instances. |
<T extends Annotation> |
all(Class<T> type)
|
<T extends Annotation> |
get(Class<T> type)
Get the 'strongest'
Annotation instance of this type. |
static Annotations |
on(Class<?> type) |
static Annotations |
on(Field field) |
static Annotations |
on(Method method) |
static Annotations |
onField(Class<?> type,
String fieldName) |
static Annotations |
onMethod(Class<?> type,
String methodName,
Class<?>... argTypes) |
static Annotations on(Class<?> type)
static Annotations on(Field field)
static Annotations onField(Class<?> type, String fieldName)
static Annotations on(Method method)
static Annotations onMethod(Class<?> type, String methodName, Class<?>... argTypes)
Stream<Annotation> all()
Annotation instances.
If the annotation type is Repeatable, the same type
can show up several times, eventually with different properties.<T extends Annotation> Optional<T> get(Class<T> type)
Annotation instance of this type.
Multiple annotations may be applicable, e.g. from several mixins or stereotypes.
The annotation will be picked in this order:
AmbiguousAnnotationResolutionException is thrown. I.e. when an annotation is changed
to be repeatable, all frameworks using this annotation will have to use all(Class) instead
(of course), but the semantics for the client code changes, which may break existing code.<T extends Annotation> Stream<T> all(Class<T> type)
Copyright © 2018–2022. All rights reserved.