File tree Expand file tree Collapse file tree
src/main/java/com/fasterxml/jackson/annotation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ NOTE: Jackson 3.x components rely on 2.x annotations; there are no separate
1616
17172.22 (not yet released)
1818
19+ #78 : Add `@JsonApplyView` to allow changing active JsonView on submodels
20+ (requested by Michael I)
21+ (contributed by @f-aubert)
1922#339 : Add `OptBoolean` valued property " order" in `@JsonIncludeProperties`
2023#342 : Add `@JsonTypeInfo.writeTypeIdForDefaultImpl` to allow skipping
2124 writing of type id for values of default type
Original file line number Diff line number Diff line change 1+ package com .fasterxml .jackson .annotation ;
2+
3+ import java .lang .annotation .ElementType ;
4+ import java .lang .annotation .Retention ;
5+ import java .lang .annotation .RetentionPolicy ;
6+ import java .lang .annotation .Target ;
7+
8+ /**
9+ * Annotation used for specifying view that should be used to process
10+ * the property that is defined by method or field annotated.
11+ *<p>
12+ * An example annotation would be:
13+ *<pre>
14+ * @JsonApplyView(BasicView.class)
15+ * public MyValue value;
16+ *</pre>
17+ * which would specify that property annotated would be processed
18+ * using View identified by {@code BasicView.class}.
19+ *<p>
20+ * Note: initially processing only covers serialization.
21+ *
22+ * @since 2.22
23+ */
24+ @ Target ({ElementType .ANNOTATION_TYPE ,
25+ ElementType .CONSTRUCTOR , ElementType .FIELD , ElementType .METHOD })
26+ @ Retention (RetentionPolicy .RUNTIME )
27+ @ JacksonAnnotation
28+ public @interface JsonApplyView
29+ {
30+ /**
31+ * View that should be used to process annotated property, if any;
32+ * special value {@link JsonApplyView.NONE} indicates that no View
33+ * should used.
34+ */
35+ public Class <?> value () default NONE .class ;
36+
37+ /**
38+ * Special view indicating no views should be used for processing annotated property.
39+ */
40+ static public interface NONE {}
41+ }
You can’t perform that action at this time.
0 commit comments