3030 * since it would associate same annotation for all fields, leading to name
3131 * collision.
3232 *<p>
33- * Starting with Jackson 2.6 this annotation may also be
33+ * This annotation may also be
3434 * used to change serialization of {@code Enum} like so:
3535 *<pre>
3636public enum MyEnum {
@@ -39,13 +39,12 @@ public enum MyEnum {
3939}
4040</pre>
4141 * as an alternative to using {@link JsonValue} annotation.
42- *<br / >
42+ *<br>
4343 * NOTE: for {@code Enum}s, empty String is a valid value (and
4444 * missing {@code value} is taken as empty String), unlike for regular
4545 * properties, and does NOT mean "use default Enum name".
46- * (handling fixed in Jackson 2.19)
4746 *<p>
48- * Starting with Jackson 2.12 it is also possible to specify {@code namespace}
47+ * It is also possible to specify {@code namespace}
4948 * of property: this property is only used by certain format backends (most
5049 * notably XML).
5150 */
@@ -82,21 +81,33 @@ public enum MyEnum {
8281 * Optional namespace to use with data formats that support such
8382 * concept (specifically XML); if so, used with {@link #value} to
8483 * construct fully-qualified name.
85- *
86- * @since 2.12
8784 */
8885 String namespace () default "" ;
8986
9087 /**
91- * Property that indicates whether a value (which may be explicit
92- * null) is expected for property during deserialization or not.
93- * If expected, <code>BeanDeserialized</code> should indicate
88+ * Property similar to {@link #isRequired}, but one that only
89+ * allows two values ({@code true} and {@code false}), defaulting
90+ * to {@code false}.
91+ *
92+ * @deprecated Since 3.0 use {@link #isRequired} instead
93+ */
94+ @ Deprecated
95+ boolean required () default false ;
96+
97+ /**
98+ * Property that MAY indicate whether a value (which may be explicit
99+ * null) is required for a property during deserialization or not.
100+ * If required ({code OptBoolean.TRUE}), {@code Deserializer} should indicate
94101 * this as a validity problem (usually by throwing an exception,
95102 * but this may be sent via problem handlers that can try to
96- * rectify the problem, for example, by supplying a default
97- * value).
103+ * rectify the problem, for example, by supplying a default value) if no
104+ * value is present in incoming content. If not required ({code OptBoolean.FALSE}),
105+ * no checking is to be done.
106+ * If not specified ({code OptBoolean.DEFAULT}) checking depends on higher
107+ * level settings (some modules may specify default "required-ness" for certain
108+ * kinds of properties).
98109 *<p>
99- * Note that as of 2.6 , this property is only used for Creator
110+ * Note that as of 3.0 , this property is only used for Creator
100111 * Properties, to ensure existence of property value in JSON:
101112 * for other properties (ones injected using a setter or mutable
102113 * field), no validation is performed. Support for those cases
@@ -112,9 +123,13 @@ public enum MyEnum {
112123 * this property should be set to {@code false}. This is important because
113124 * validation of {@code required} properties occurs before the application of
114125 * secondary sources.
126+ *<p>
127+ * Default value ({@link OptBoolean#DEFAULT}) means that "required-ness"
128+ * is not specified by this annotation -- it is up to more general settings
129+ * (per-class, global) to determine whether the property is required or not.
115130 */
116- boolean required () default false ;
117-
131+ OptBoolean isRequired () default OptBoolean . DEFAULT ;
132+
118133 /**
119134 * Property that indicates numerical index of this property (relative
120135 * to other properties specified for the Object). This index
0 commit comments