File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
src/main/java/com/fasterxml/jackson/databind/introspect Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,16 @@ public Type getGenericType() {
76
76
*/
77
77
public abstract Class <?> getRawType ();
78
78
79
+ /**
80
+ * Accessor that can be used to iterate over all the annotations
81
+ * associated with annotated component.
82
+ *
83
+ * @since 2.3
84
+ * @deprecated Since 2.9 should instead use {@link #getAnnotated()}
85
+ */
86
+ @ Deprecated
87
+ public abstract Iterable <Annotation > annotations ();
88
+
79
89
// Also: ensure we can use #equals, #hashCode
80
90
81
91
@ Override
Original file line number Diff line number Diff line change @@ -247,6 +247,18 @@ public Class<?> getRawType() {
247
247
return _class ;
248
248
}
249
249
250
+ @ Override
251
+ @ Deprecated
252
+ public Iterable <Annotation > annotations () {
253
+ if (_classAnnotations instanceof AnnotationMap ) {
254
+ return ((AnnotationMap ) _classAnnotations ).annotations ();
255
+ } else if (_classAnnotations instanceof AnnotationCollector .OneAnnotation ||
256
+ _classAnnotations instanceof AnnotationCollector .TwoAnnotations ) {
257
+ throw new UnsupportedOperationException ("please use getAnnotations/ hasAnnotation to check for Annotations" );
258
+ }
259
+ return Collections .emptyList ();
260
+ }
261
+
250
262
@ Override
251
263
public JavaType getType () {
252
264
return _type ;
Original file line number Diff line number Diff line change 2
2
3
3
import java .lang .annotation .Annotation ;
4
4
import java .lang .reflect .Member ;
5
+ import java .util .Collections ;
5
6
6
7
import com .fasterxml .jackson .databind .util .ClassUtil ;
7
8
@@ -103,6 +104,15 @@ public boolean hasOneOf(Class<? extends Annotation>[] annoClasses) {
103
104
return _annotations .hasOneOf (annoClasses );
104
105
}
105
106
107
+ @ Override
108
+ @ Deprecated
109
+ public Iterable <Annotation > annotations () {
110
+ if (_annotations == null ) {
111
+ return Collections .emptyList ();
112
+ }
113
+ return _annotations .annotations ();
114
+ }
115
+
106
116
/**
107
117
*<p>
108
118
* NOTE: promoted in 2.9 from `Annotated` up
You can’t perform that action at this time.
0 commit comments