|
90 | 90 | * It may also be used by Jackson extension modules; core jackson databind
|
91 | 91 | * does not have any automated handling beyond simply exposing this
|
92 | 92 | * value through bean property introspection.
|
| 93 | + *<p> |
| 94 | + * It is possible that in future this annotation could be used for value |
| 95 | + * defaulting, and especially for default values of Creator properties, |
| 96 | + * since they support {@link #required()} in 2.6 and above. |
93 | 97 | *
|
94 | 98 | * @since 2.5
|
95 | 99 | */
|
96 | 100 | String defaultValue() default "";
|
| 101 | + |
| 102 | + /** |
| 103 | + * Optional property that may be used to change the way visibility of |
| 104 | + * accessors (getter, field-as-getter) and mutators (contructor parameter, |
| 105 | + * setter, field-as-setter) is determined, either so that otherwise |
| 106 | + * non-visible accessors (like private getters) may be used; or that |
| 107 | + * otherwise visible accessors are ignored. |
| 108 | + *<p> |
| 109 | + * Default value os {@link Access#AUTO} which means that access is determined |
| 110 | + * solely based on visibility and other annotations. |
| 111 | + * |
| 112 | + * @since 2.6 |
| 113 | + */ |
| 114 | + Access access() default Access.AUTO; |
| 115 | + |
| 116 | + /** |
| 117 | + * Various options for {@link #access} property, specifying how property |
| 118 | + * may be accessed during serialization ("read") and deserialization ("write") |
| 119 | + * (note that the direction of read and write is from perspective of the property, |
| 120 | + * not from external data format: this may be confusing in some contexts). |
| 121 | + *<p> |
| 122 | + * Note that while this annotation modifies access to annotated property, |
| 123 | + * its effects may be further overridden by {@link JsonIgnore} property: |
| 124 | + * if both annotations are present on an accessors, {@link JsonIgnore} |
| 125 | + * has precedence over this property. |
| 126 | + * |
| 127 | + * @since 2.6 |
| 128 | + */ |
| 129 | + public enum Access |
| 130 | + { |
| 131 | + /** |
| 132 | + * Access setting which means that visibility rules are to be used |
| 133 | + * to automatically determine read- and/or write-access of this property. |
| 134 | + */ |
| 135 | + AUTO, |
| 136 | + |
| 137 | + /** |
| 138 | + * Access setting that means that the property may only be read for serialization, |
| 139 | + * but not written (set) during deserialization. |
| 140 | + */ |
| 141 | + READ_ONLY, |
| 142 | + |
| 143 | + /** |
| 144 | + * Access setting that means that the property may only be written (set) |
| 145 | + * for deserialization, |
| 146 | + * but will not be read (get) on serialization, that is, the value of the property |
| 147 | + * is not included in serialization. |
| 148 | + */ |
| 149 | + WRITE_ONLY, |
| 150 | + |
| 151 | + /** |
| 152 | + * Access setting that means that the property will be accessed for both |
| 153 | + * serialization (writing out values as external representation) |
| 154 | + * and deserialization (reading values from external representation), |
| 155 | + * regardless of visibility rules. |
| 156 | + */ |
| 157 | + READ_WRITE |
| 158 | + ; |
| 159 | + } |
97 | 160 | }
|
0 commit comments