Package com.github.t1.annotations
Interface Annotations
-
public interface Annotations
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Stream<Annotation>all()Get allAnnotationinstances.<T extends Annotation>
Stream<T>all(Class<T> type)<T extends Annotation>
Optional<T>get(Class<T> type)Get the 'strongest'Annotationinstance of this type.static Annotationson(Class<?> type)static Annotationson(Field field)static Annotationson(Method method)static AnnotationsonField(Class<?> type, String fieldName)static AnnotationsonMethod(Class<?> type, String methodName, Class<?>... argTypes)
-
-
-
Method Detail
-
on
static Annotations on(Class<?> type)
-
on
static Annotations on(Field field)
-
onField
static Annotations onField(Class<?> type, String fieldName)
-
on
static Annotations on(Method method)
-
onMethod
static Annotations onMethod(Class<?> type, String methodName, Class<?>... argTypes)
-
all
Stream<Annotation> all()
Get allAnnotationinstances. If the annotation type isRepeatable, the same type can show up several times, eventually with different properties.
-
get
<T extends Annotation> Optional<T> get(Class<T> type)
Get the 'strongest'Annotationinstance of this type. Multiple annotations may be applicable, e.g. from several mixins or stereotypes. The annotation will be picked in this order:- mixin
- target
- target stereotypes
- containing class
- containing class stereotypes
- containing package (TODO not yet implemented)
- containing package stereotypes (TODO not yet implemented)
AmbiguousAnnotationResolutionExceptionis thrown. I.e. when an annotation is changed to be repeatable, all frameworks using this annotation will have to useall(Class)instead (of course), but the semantics for the client code changes, which may break existing code.
-
all
<T extends Annotation> Stream<T> all(Class<T> type)
-
-