Skip to content

Commit 7556060

Browse files
committed
#29 - Fix signature of AnnotationTarget#getMetaAnnotated
1 parent 417bfa6 commit 7556060

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/main/java/org/hibernate/models/spi/AnnotationTarget.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,30 @@ default <X extends Annotation> void forEachAnnotationUsage(
133133
<X extends Annotation> void forEachAnnotationUsage(Class<X> type, Consumer<AnnotationUsage<X>> consumer);
134134

135135
/**
136-
* Returns all annotations on this target where the annotation class is annotated with `metaAnnotationType`.
136+
* Returns all AnnotationUsage references from this target where the usage's
137+
* {@linkplain AnnotationUsage#getAnnotationDescriptor() annotation class} is annotated
138+
* with the given {@code metaAnnotationType}.
139+
* <p/>
140+
* E.g., given the following class and annotations
141+
* <pre class="brush:java">
142+
* {@code @interface TheMeta} {
143+
* ...
144+
* }
145+
*
146+
* {@code @TheMeta(...)}
147+
* {@code @interface TheAnnotation} {
148+
* ...
149+
* }
150+
*
151+
* {@code @TheAnnotation}
152+
* {@code class TheClass} {
153+
* ...
154+
* }
155+
* </pre>
156+
* a call to this method passing {@code TheMeta} on {@code ClassDetails(TheClass)} will return
157+
* the usage of {@code @TheAnnotation} on {@code TheClass}.
137158
*/
138-
default List<AnnotationUsage<?>> getMetaAnnotated(Class<? extends Annotation> metaAnnotationType) {
159+
default <A extends Annotation> List<AnnotationUsage<? extends Annotation>> getMetaAnnotated(Class<A> metaAnnotationType) {
139160
final List<AnnotationUsage<?>> usages = new ArrayList<>();
140161
forAllAnnotationUsages( (usage) -> {
141162
final AnnotationUsage<? extends Annotation> metaUsage = usage.getAnnotationDescriptor().getAnnotationUsage( metaAnnotationType );

0 commit comments

Comments
 (0)