152152 */
153153 public enum Shape
154154 {
155+ // // // Concrete physical shapes, scalars
155156 /**
156- * Marker enum value that indicates "whatever" choice, meaning that annotation
157- * does NOT specify shape to use.
158- * Note that this is different from {@link Shape#NATURAL}, which
159- * specifically instructs use of the "natural" shape for datatype.
160- */
161- ANY ,
162-
163- /**
164- * Marker enum value that indicates the "default" choice for given datatype;
165- * for example, JSON String for {@link java.lang.String}, or JSON Number
166- * for Java numbers.
167- * Note that this is different from {@link Shape#ANY} in that this is actual
168- * explicit choice that overrides possible default settings.
157+ * Value that indicates that Binary type (native, if format supports it;
158+ * encoding using Base64 if only textual types supported) should be used.
169159 *
170- * @since 2.8
171- */
172- NATURAL ,
173-
174- /**
175- * Value that indicates shape should not be structural (that is, not
176- * {@link #ARRAY} or {@link #OBJECT}), but can be any other shape.
177- */
178- SCALAR ,
179-
180- /**
181- * Value that indicates that (JSON) Array type should be used.
160+ * @since 2.10
182161 */
183- ARRAY ,
162+ BINARY ,
184163
185164 /**
186- * Value that indicates that (JSON) Object type should be used.
165+ * Value that indicates that (JSON) boolean type
166+ * (true, false) should be used.
187167 */
188- OBJECT ,
168+ BOOLEAN ,
189169
190170 /**
191171 * Value that indicates that a numeric (JSON) type should be used
@@ -211,26 +191,71 @@ public enum Shape
211191 STRING ,
212192
213193 /**
214- * Value that indicates that (JSON) boolean type
215- * (true, false) should be used .
194+ * Value that indicates shape should not be structural (that is, not
195+ * {@link #ARRAY} or {@link #OBJECT}), but can be any other shape .
216196 */
217- BOOLEAN ,
197+ SCALAR ,
198+
199+ // // // Concrete physical shapes, structured
218200
219201 /**
220- * Value that indicates that Binary type (native, if format supports it;
221- * encoding using Base64 if only textual types supported) should be used.
202+ * Value that indicates that (JSON) Array type should be used.
203+ */
204+ ARRAY ,
205+
206+ /**
207+ * Value that indicates that (JSON) Object type should be used.
208+ */
209+ OBJECT ,
210+
211+ // // // Additional logical meta-types
212+
213+ /**
214+ * Marker enum value that indicates "whatever" choice, meaning that annotation
215+ * does NOT specify shape to use.
216+ * Note that this is different from {@link Shape#NATURAL}, which
217+ * specifically instructs use of the "natural" shape for datatype.
218+ */
219+ ANY ,
220+
221+ /**
222+ * Marker enum value that indicates the "default" choice for given datatype;
223+ * for example, JSON String for {@link java.lang.String}, or JSON Number
224+ * for Java numbers.
225+ * Note that this is different from {@link Shape#ANY} in that this is actual
226+ * explicit choice that overrides possible default settings.
222227 *
223- * @since 2.10
228+ * @since 2.8
229+ */
230+ NATURAL ,
231+
232+ /**
233+ * Marker enum value that indicates not only shape of {@link #OBJECT} but further
234+ * handling as POJO, where applicable. Mostly makes difference at Java Object level
235+ * when distinguishing handling between {@link java.util.Map} and POJO types.
236+ *
237+ * @since 2.20
224238 */
225- BINARY
239+ POJO ,
240+
226241 ;
227242
228243 public boolean isNumeric () {
229244 return (this == NUMBER ) || (this == NUMBER_INT ) || (this == NUMBER_FLOAT );
230245 }
231246
247+ /** @since 2.20 */
248+ public static boolean isNumeric (Shape shapeOrNull ) {
249+ return (shapeOrNull != null ) && shapeOrNull .isNumeric ();
250+ }
251+
232252 public boolean isStructured () {
233- return (this == OBJECT ) || (this == ARRAY );
253+ return (this == OBJECT ) || (this == ARRAY ) || (this == POJO );
254+ }
255+
256+ /** @since 2.20 */
257+ public static boolean isStructured (Shape shapeOrNull ) {
258+ return (shapeOrNull != null ) && shapeOrNull .isStructured ();
234259 }
235260 }
236261
@@ -550,6 +575,7 @@ public Value(String p, Shape sh, Locale l, String tzStr, TimeZone tz, Features f
550575 public Value (String p , Shape sh , String localeStr , String tzStr , Features f ) {
551576 this (p , sh , localeStr , tzStr , f , null );
552577 }
578+
553579 @ Deprecated // since 2.9
554580 public Value (String p , Shape sh , Locale l , TimeZone tz , Features f ) {
555581 this (p , sh , l , tz , f , null );
0 commit comments