@@ -221,4 +221,60 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
221
221
}
222
222
throw new InvalidTypeException ("Invalid input type=" +getClass (arg )+". It can't be validated by this schema" );
223
223
}
224
+
225
+ public static abstract sealed class AnyTypeBoxed permits AnyTypeBoxedVoid , AnyTypeBoxedBoolean , AnyTypeBoxedNumber , AnyTypeBoxedString , AnyTypeBoxedList , AnyTypeBoxedMap {
226
+ }
227
+ public static final class AnyTypeBoxedVoid extends AnyTypeBoxed {
228
+ public final Void data ;
229
+ private AnyTypeBoxedVoid (Void data ) {
230
+ this .data = data ;
231
+ }
232
+ }
233
+ public static final class AnyTypeBoxedBoolean extends AnyTypeBoxed {
234
+ public final boolean data ;
235
+ private AnyTypeBoxedBoolean (boolean data ) {
236
+ this .data = data ;
237
+ }
238
+ }
239
+ public static final class AnyTypeBoxedNumber extends AnyTypeBoxed {
240
+ public final Number data ;
241
+ private AnyTypeBoxedNumber (Number data ) {
242
+ this .data = data ;
243
+ }
244
+ }
245
+ public static final class AnyTypeBoxedString extends AnyTypeBoxed {
246
+ public final String data ;
247
+ private AnyTypeBoxedString (String data ) {
248
+ this .data = data ;
249
+ }
250
+ }
251
+ public static final class AnyTypeBoxedList extends AnyTypeBoxed {
252
+ public final FrozenList <@ Nullable Object > data ;
253
+ private AnyTypeBoxedList (FrozenList <@ Nullable Object > data ) {
254
+ this .data = data ;
255
+ }
256
+ }
257
+ public static final class AnyTypeBoxedMap extends AnyTypeBoxed {
258
+ public final FrozenMap <@ Nullable Object > data ;
259
+ private AnyTypeBoxedMap (FrozenMap <@ Nullable Object > data ) {
260
+ this .data = data ;
261
+ }
262
+ }
263
+ public AnyTypeBoxed validateToBoxed (@ Nullable Object arg , SchemaConfiguration configuration ) throws ValidationException , InvalidTypeException {
264
+ if (arg == null ) {
265
+ return new AnyTypeBoxedVoid (validate ((Void ) null , configuration ));
266
+ } else if (arg instanceof Boolean ) {
267
+ boolean boolArg = (Boolean ) arg ;
268
+ return new AnyTypeBoxedBoolean (validate (boolArg , configuration ));
269
+ } else if (arg instanceof Number ) {
270
+ return new AnyTypeBoxedNumber (validate ((Number ) arg , configuration ));
271
+ } else if (arg instanceof String ) {
272
+ return new AnyTypeBoxedString (validate ((String ) arg , configuration ));
273
+ } else if (arg instanceof List ) {
274
+ return new AnyTypeBoxedList (validate ((List <?>) arg , configuration ));
275
+ } else if (arg instanceof Map ) {
276
+ return new AnyTypeBoxedMap (validate ((Map <?, ?>) arg , configuration ));
277
+ }
278
+ throw new InvalidTypeException ("Invalid input type=" +getClass (arg )+". It can't be validated by this schema" );
279
+ }
224
280
}
0 commit comments