1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
package Torello.JSON;

import Torello.Java.StringParse;
import Torello.Java.UnreachableError;

import Torello.Java.Function.IntTFunction;
import Torello.Java.Function.IntIntTFunc;

import Torello.Java.Additional.Counter;

import java.util.function.Function;
import java.util.function.Predicate;

import java.math.BigDecimal;
import java.math.BigInteger;

import javax.json.JsonNumber;
import javax.json.JsonObject;
import javax.json.JsonArray;


// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// This class provides LAMBDA'S / FUNCTION-POINTERS / FUNCTIONAL-INTERFACES
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// 
// OK, This Class provides the Vast-Majority of the Lambda / Functional-Interfaces that can be 
// associated with the Standard Java Primitive-Types which are handled by this Json-Package.  This 
// Package handle 7 of 8 standard Java-Types, but leaves out the 'char' Primitive-Type, because 
// Json doesn't have much of anything resembling a 'char' type, and the concept just seemed 
// generally, completely unnecessary.
// 
// This class also has a configuration-record for the types: String, Number & even Object.
// 
//
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// WHAT TO KNOW ABOUT THESE LAMBDA'S
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// 
// The Lambda's which are "stored" or "saved" in all of the builder methods here are exactly the 
// Lambda's which *DO NOT REQUIRE USER-INPUT* in order to generate.  This is "as opposed to" the
// Functional-Interfaces which are produced by the Class 'TempFlags'.
// 
// In class "TempFlags", the Lambda-Functions that are generated / selected / produced there are
// in *STRICT ADHERENCE* with the choices that the user has made using the "JFlags" parameter - the
// Flag-Mask that allows a user to confgure specific behavior of the Json-Parser.
// 
// To summarize - *AGAIN* - the Lambda's / Functional-Interfaces / a.k.a. "Method Pointers" which 
// are declared inside this class are all of the ones which are associated with the **SPECIFIC 
// TYPE** that was decided-upon, based on the RJArr Method that he has invoked.  These Lambda's
// are constant, and would never change based on user-preference.  Though they could be eliminated
// or ignored, it isn't possible for them to "Modified by User-Preferences", etc...
// 
// Class 'TempFlags' has a giant dispatch engine that dispatches based on flags the user has
// provided
// 
// 
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// The "Funtion-Pointer" Reminder
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// 
// It is important to remember that everything that is done inside the Json-Array Processing 
// Classes (Specifically, those which begin with "RJArr") - is done by a single "Processing Loop"
// Main-Class.  Please review the contents of the "ProcessJsonArray" class to see how any 
// invocation of either the RJArr: Stream, Consumer or Array Classes all use the "ProcessJsonArray"
// class to perform their parse.
// 
// This is acheived by wrapping the dozens of User-Choices, Configurations, Preferences & 
// Selections into a suite of Functional-Interfaces (Function-Pointers) and saving them inide of 
// a giant "SettingsRec".  The Java Byte-Code Optimizer is likely capable of doing enough 
// optimizations to ensure that all of the Pointer-Reference "De-Referencing" that is going on 
// is done efficiently.  More testing needs to be done to check this out...

public class BASIC_TYPES<T>
{
    // ********************************************************************************************
    // ********************************************************************************************
    // Main Fields  (These are used to FURTHER help configure class "SettingsRec")
    // ********************************************************************************************
    // ********************************************************************************************


    // Used by the Multi-Dimensional Array Processor only
    // final Function<JsonArray, U> array1DGenerator;

    final byte whichType;

    // Essentially: Not STRING, BOOLEAN or OBJECT
    final boolean isNumberType;

    // same as primitive or boxed (I think)
    final boolean referenceOrPrimitive;

    // Class of the Stream.Builder "accept" Parameter
    final Class<T> CLASS;

    // Number size tester
    final Predicate<JsonNumber> jsonNumWillFit;

    // String-tester (for parsing number-strings)
    final Predicate<String> validStrTester;

    // default-parser (number-string to Integer)
    final Function<String, T> defaultParser;

    // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
    final Function<Number, T> numberConverter;

    // Generates AEX on fail
    final Function<BigDecimal, T> numberConverterExThrow;


    // ********************************************************************************************
    // ********************************************************************************************
    // Exported (and also internally used) Static Constants
    // ********************************************************************************************
    // ********************************************************************************************


    static final boolean REFERENCE  = true;
    static final boolean BOXED      = true;
    static final boolean PRIMITIVE  = false;

    static final byte INTEGER = 0;
    static final byte SHORT   = 1;
    static final byte BYTE    = 2;
    static final byte LONG    = 3;
    static final byte DOUBLE  = 4;
    static final byte FLOAT   = 5;

    static final byte BOOLEAN = 6;
    static final byte NUMBER  = 7;
    static final byte STRING  = 8;

    static final byte JSON_OBJECT   = 9;
    static final byte JSON_ARRAY    = 10;

    static final byte EXTENDED_OBJ  = 11;


    // ********************************************************************************************
    // ********************************************************************************************
    // Internal, Private, Static Singleton-Instances THAT ARE INITIALLY NULL AND ARE LAZILY-LOADED!
    // ********************************************************************************************
    // ********************************************************************************************


    // Rather than generating 18 Records, 16 or 17 of which will likely never be used throughout 
    // the life-cycle of the program, this set of fields are all assigned null, and are not
    // instantiated until they are requested by the user.
    // 
    // These are, indeed, all singleton instances that contain CONSTANT-DATA which is re-used for 
    // each and every call for a request of the configurations that are present inside this data
    // class.

    private static BASIC_TYPES<Integer>     BOXED_INTEGER       = null;
    private static BASIC_TYPES<Integer>     PRIMITIVE_INTEGER   = null;

    private static BASIC_TYPES<Short>       BOXED_SHORT         = null;
    private static BASIC_TYPES<Short>       PRIMITIVE_SHORT     = null;

    private static BASIC_TYPES<Byte>        BOXED_BYTE          = null;
    private static BASIC_TYPES<Byte>        PRIMITIVE_BYTE      = null;

    private static BASIC_TYPES<Long>        BOXED_LONG          = null;
    private static BASIC_TYPES<Long>        PRIMITIVE_LONG      = null;

    private static BASIC_TYPES<Double>      BOXED_DOUBLE        = null;
    private static BASIC_TYPES<Double>      PRIMITIVE_DOUBLE    = null;

    private static BASIC_TYPES<Float>       BOXED_FLOAT         = null;
    private static BASIC_TYPES<Float>       PRIMITIVE_FLOAT     = null;

    private static BASIC_TYPES<Boolean>     BOXED_BOOLEAN       = null;
    private static BASIC_TYPES<Boolean>     PRIMITIVE_BOOLEAN   = null;

    private static BASIC_TYPES<String>      STRING_REC          = null;
    private static BASIC_TYPES<Number>      NUMBER_REC          = null;

    private static BASIC_TYPES<JsonObject>  JSON_OBJECT_REC     = null;
    private static BASIC_TYPES<JsonArray>   JSON_ARRAY_REC      = null;


    // ********************************************************************************************
    // ********************************************************************************************
    // The Lazy-Loading Methods / Getters (These methods do both at the same time)
    // ********************************************************************************************
    // ********************************************************************************************


    // These are nothing more than "getters" for the above Data-Field Singleton-Instances.  These 
    // 18 methods are simply designed to return the same constant singleton instance each and every
    // time that any of these methods are invoked.
    // 
    // Most important, notice that on the very first call to these methods, the value assigned to 
    // these fields will always be null (after being loaded by the class-loader).  These methods 
    // will call the constructor for these fields the first time they are called, and then from
    // point forward, the same singleton will be returned each and ever time

    static BASIC_TYPES<Integer> BOXED_INTEGER()
    { return (BOXED_INTEGER !=null) ? BOXED_INTEGER : (BOXED_INTEGER = INTEGER(BOXED)); }

    static BASIC_TYPES<Integer> PRIMITIVE_INTEGER()
    {
        return (PRIMITIVE_INTEGER !=null)
            ? PRIMITIVE_INTEGER
            : (PRIMITIVE_INTEGER = INTEGER(PRIMITIVE));
    }


    static BASIC_TYPES<Short> BOXED_SHORT()
    { return (BOXED_SHORT !=null) ? BOXED_SHORT : (BOXED_SHORT = SHORT(BOXED)); }

    static BASIC_TYPES<Short> PRIMITIVE_SHORT()
    { return (PRIMITIVE_SHORT !=null) ? PRIMITIVE_SHORT : (PRIMITIVE_SHORT = SHORT(PRIMITIVE)); }


    static BASIC_TYPES<Byte> BOXED_BYTE()
    { return (BOXED_BYTE !=null) ? BOXED_BYTE : (BOXED_BYTE = BYTE(BOXED)); }

    static BASIC_TYPES<Byte> PRIMITIVE_BYTE()
    { return (PRIMITIVE_BYTE !=null) ? PRIMITIVE_BYTE : (PRIMITIVE_BYTE = BYTE(PRIMITIVE)); }


    static BASIC_TYPES<Long> BOXED_LONG()
    { return (BOXED_LONG !=null) ? BOXED_LONG : (BOXED_LONG = LONG(BOXED)); }

    static BASIC_TYPES<Long> PRIMITIVE_LONG()
    { return (PRIMITIVE_LONG !=null) ? PRIMITIVE_LONG : (PRIMITIVE_LONG = LONG(PRIMITIVE)); }


    static BASIC_TYPES<Double> BOXED_DOUBLE()
    { return (BOXED_DOUBLE !=null) ? BOXED_DOUBLE : (BOXED_DOUBLE = DOUBLE(BOXED)); }

    static BASIC_TYPES<Double> PRIMITIVE_DOUBLE()
    {
        return (PRIMITIVE_DOUBLE !=null)
            ? PRIMITIVE_DOUBLE
            : (PRIMITIVE_DOUBLE = DOUBLE(PRIMITIVE));
    }


    static BASIC_TYPES<Float> BOXED_FLOAT()
    { return (BOXED_FLOAT !=null) ? BOXED_FLOAT : (BOXED_FLOAT = FLOAT(BOXED)); }

    static BASIC_TYPES<Float> PRIMITIVE_FLOAT()
    { return (PRIMITIVE_FLOAT !=null) ? PRIMITIVE_FLOAT : (PRIMITIVE_FLOAT = FLOAT(PRIMITIVE)); }


    static BASIC_TYPES<Boolean> BOXED_BOOLEAN()
    { return (BOXED_BOOLEAN !=null) ? BOXED_BOOLEAN : (BOXED_BOOLEAN = BOOLEAN(BOXED)); }

    static BASIC_TYPES<Boolean> PRIMITIVE_BOOLEAN()
    {
        return (PRIMITIVE_BOOLEAN !=null)
            ? PRIMITIVE_BOOLEAN
            : (PRIMITIVE_BOOLEAN = BOOLEAN(PRIMITIVE));
    }


    static BASIC_TYPES<Number> NUMBER_REC()
    { return (NUMBER_REC !=null) ? NUMBER_REC : (NUMBER_REC = NUMBER()); }

    static BASIC_TYPES<String> STRING_REC()
    { return (STRING_REC !=null) ? STRING_REC : (STRING_REC = STRING()); }

    static BASIC_TYPES<JsonObject> JSON_OBJECT_REC()
    { return (JSON_OBJECT_REC !=null) ? JSON_OBJECT_REC : (JSON_OBJECT_REC = JO()); }

    static BASIC_TYPES<JsonArray> JSON_ARRAY_REC()
    { return (JSON_ARRAY_REC !=null) ? JSON_ARRAY_REC : (JSON_ARRAY_REC = JA()); }


    // ********************************************************************************************
    // ********************************************************************************************
    // Constructor
    // ********************************************************************************************
    // ********************************************************************************************


    private BASIC_TYPES(
            final byte                      whichType,
            final boolean                   referenceOrPrimitive,
            final Class<T>                  CLASS,
            final Predicate<JsonNumber>     jsonNumWillFit,
            final Predicate<String>         validStrTester,
            final Function<String, T>       defaultParser,
            final Function<Number, T>       numberConverter,
            final Function<BigDecimal, T>   numberConverterExThrow
        )
    {
        this.whichType              = whichType;
        this.referenceOrPrimitive   = referenceOrPrimitive;
        this.CLASS                  = CLASS;   
        this.jsonNumWillFit         = jsonNumWillFit;
        this.validStrTester         = validStrTester;
        this.defaultParser          = defaultParser;
        this.numberConverter        = numberConverter;
        this.numberConverterExThrow = numberConverterExThrow;

        this.isNumberType =
                (this.whichType != STRING)
            &&  (this.whichType != BOOLEAN)
            &&  (this.whichType != JSON_OBJECT)
            &&  (this.whichType != JSON_ARRAY);


        // This constructor is private, and cannot be used by the "EXTENDED_TYPES" subclass.
        // Leave this here, because is serves (sort of) as a comment, and a reminder.

        if (this.whichType == EXTENDED_OBJ) throw new UnreachableError();
    }


    // This is a specialize constructor which is being added to allow for providing an
    // "Object-Builder" variant of the "objArr".  What that means, in English, is that a new 
    // version of the method for reading an Array of Objects is being added.  The original version
    // of "Object Array Handler" required that the Object have a constructor which accepts a 
    // Json-Object as Input in order to produce an instance of the Object.
    // 
    // This new variant of "Basic Type" will allow the user to provide any old lambda function,
    // whatsoever, to produce / build / construct an instance of the Object that has been retrieved
    // from the Json-Array of Objects.  This feature was added in April 2025.  It is needed for the
    // Java-Doc Frames & Package-Summary Sorter "Feature."  The user provides a Json based 
    // Configuration-File, and that Configuration-File contains an array of objects.
    // 
    // The Code looks much nicer when there is a "B1" Builder and a "D1" Data-Record, than when
    // there is just one giant "D1" Data-Record with a large constructor shoved inside of it.  
    // By adding this new "Basic-Type" thing-y, I can separate the two!

    // Here is the original constructor.  Since there is only one method that invokes this
    // constructor there is, therefore, no need to accept all of these parameters, and they can be
    // automatically hard-wired to accept null.

    BASIC_TYPES(final Class<T> CLASS)
    {
        this.whichType              = EXTENDED_OBJ;
        this.referenceOrPrimitive   = true;
        this.CLASS                  = CLASS;   
        this.jsonNumWillFit         = null;
        this.validStrTester         = null;
        this.defaultParser          = null;
        this.numberConverter        = null;
        this.numberConverterExThrow = null;
        this.isNumberType           = false;
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // All of the actual Configurations themselves - as "private static builder methods"
    // ********************************************************************************************
    // ********************************************************************************************


    private static BASIC_TYPES<Integer> INTEGER(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            INTEGER,                    // final byte       whichType
            boxedOrPrimitive,           // final boolean    referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Integer.class : int.class,

            // final Predicate<JsonNumber> jsonNumWillFit
            (JsonNumber jn) -> jn.numberValue().getClass() == Integer.class,

            StringParse::isInteger,     // final Predicate<String>          validStrTester
            Integer::parseInt,          // final Function<String, T>        defaultParser
            Number::intValue,           // final Function<Number, T>        numberConverter
            BigDecimal::intValueExact   // final Function<BigDecimal, T>    numberConverterExThrow
        );
    }

    private static BASIC_TYPES<Short> SHORT(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            SHORT,                      // final byte       whichType
            boxedOrPrimitive,           // final boolean    referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Short.class : short.class,

            BASIC_TYPES::shortTypePred, // final Predicate<JsonNumber>      jsonNumWillFit
            StringParse::isShort,       // final Predicate<String>          validStrTester
            Short::parseShort,          // final Function<String, T>        defaultParser
            Number::shortValue,         // final Function<Number, T>        numberConverter
            BigDecimal::shortValueExact // final Function<BigDecimal, T>    numberConverterExThrow
        );
    }

    private static BASIC_TYPES<Byte> BYTE(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            BYTE,                       // final byte       whichType
            boxedOrPrimitive,           // final boolean    referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Byte.class : byte.class,

            BASIC_TYPES::byteTypePred,  // final Predicate<JsonNumber>      jsonNumWillFit
            StringParse::isByte,        // final Predicate<String>          validStrTester
            Byte::parseByte,            // final Function<String, T>        defaultParser
            Number::byteValue,          // final Function<Number, T>        numberConverter
            BigDecimal::byteValueExact  // final Function<BigDecimal, T>    numberConverterExThrow
        );
    }

    private static BASIC_TYPES<Long> LONG(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            LONG,                       // final byte       whichType
            boxedOrPrimitive,           // final boolean    referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Long.class : long.class,

            BASIC_TYPES::longTypePred,  // final Predicate<JsonNumber>      jsonNumWillFit
            StringParse::isLong,        // final Predicate<String>          validStrTester
            Long::parseLong,            // final Function<String, T>        defaultParser
            Number::longValue,          // final Function<Number, T>        numberConverter
            BigDecimal::longValueExact  // final Function<BigDecimal, T>    numberConverterExThrow
        );
    }

    private static BASIC_TYPES<Double> DOUBLE(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            DOUBLE,                     // final byte       whichType
            boxedOrPrimitive,           // final boolean    referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Double.class : double.class,

            // final Predicate<JsonNumber> jsonNumWillFit, doubleTypePred doesn't exist
            null,

            StringParse::isDouble,      // final Predicate<String>      validStrTester
            Double::parseDouble,        // final Function<String, T>    defaultParser
            Number::doubleValue,        // final Function<Number, T>    numberConverter

            // final Function<BigDecimal, T> numberConverterExThrow
            (BigDecimal bd) -> { throw new ArithmeticException("Invalid Input"); }
        );
    }

    private static BASIC_TYPES<Float> FLOAT(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            FLOAT,                      // final byte whichType 
            boxedOrPrimitive,           // final boolean referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Float.class : float.class,

            // final Predicate<JsonNumber> jsonNumWillFit, floatTypePred doesn't exist
            null,

            StringParse::isDouble,      // final Predicate<String> validStrTester
                                        //      StringParse doesn't have an "isFloat"
            Float::parseFloat,          // final Function<String, T> defaultParser
            Number::floatValue,         // final Function<Number, T> numberConverter

            // final Function<BigDecimal, T> numberConverterExThrow
            (BigDecimal bd) -> { throw new ArithmeticException("Invalid Input"); }
        );
    }

    private static BASIC_TYPES<Boolean> BOOLEAN(final boolean boxedOrPrimitive)
    {
        return new BASIC_TYPES<>(
            BOOLEAN,                // final byte whichType 
            boxedOrPrimitive,       // final boolean referenceOrPrimitive

            // final Class<T> CLASS
            boxedOrPrimitive ? Boolean.class : boolean.class,

            // final Predicate<JsonNumber> jsonNumWillFit - Boolean is not a JsonNumber!
            null,

            s -> true,              // final Predicate<String> validStrTester
                                    //      String-tester (for parsing number-strings)
            Boolean::parseBoolean,  // final Function<String, T> defaultParser
            null,                   // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
            null                    // The Arithmetic-Exception thing
        );
    }

    private static BASIC_TYPES<Number> NUMBER()
    {
        // It's been 2.5 years since I originally wrote this, and I really don't remember
        // how this one works...

        return new BASIC_TYPES<Number>(
            NUMBER,                     // final byte                   whichType,
            BOXED,                      // final boolean                referenceOrPrimitive,
            Number.class,               // final Class<T>               CLASS,
            (JsonNumber jn) -> true,    // final Predicate<JsonNumber>  jsonNumWillFit,


            // These are all Hard-Coded into the "SettingsRec"
            // There is a special case when this.whiteType == BASIC_TYPES.NUMBER

            null,   // final Predicate<String>          validStrTester,
            null,   // final Function<String, T>        defaultParser,
            null,   // final Function<Number, T>        numberConverter,
            null    // final Function<BigDecimal, T>    numberConverterExThrow
        );
    }

    // None of these little configurtion-lambdas are needed because 'String' is not a number
    private static BASIC_TYPES<String> STRING()
    {
        return new BASIC_TYPES<>(
            STRING,         // final byte                      whichType,
            true,           // final boolean                   referenceOrPrimitive,
            String.class,   // final Class<T>                  CLASS,
            null,           // final Predicate<JsonNumber>     jsonNumWillFit,
            null,           // final Predicate<String>         validStrTester,
            null,           // final Function<String, T>       defaultParser,
            null,           // final Function<Number, T>       numberConverter w/Approx,
            null            // final Function<BigDecimal, T>   numberConverter w/AEX
        );
    }

    // None of these little configurtion-lambdas are needed because 'JsonObject' is not a number
    private static BASIC_TYPES<JsonObject> JO()
    {
        return new BASIC_TYPES<>(
            JSON_OBJECT,        // final byte                      whichType,
            true,               // final boolean                   referenceOrPrimitive,
            JsonObject.class,   // final Class<T>                  CLASS,
            null,               // final Predicate<JsonNumber>     jsonNumWillFit,
            null,               // final Predicate<String>         validStrTester,
            null,               // final Function<String, T>       defaultParser,
            null,               // final Function<Number, T>       numberConverter w/Approx,
            null                // final Function<BigDecimal, T>   numberConverter w/AEX
        );
    }

    // None of these little configurtion-lambdas are needed because 'JsonObject' is not a number
    private static BASIC_TYPES<JsonArray> JA()
    {
        return new BASIC_TYPES<>(
            JSON_ARRAY,         // final byte                      whichType,
            true,               // final boolean                   referenceOrPrimitive,
            JsonArray.class,    // final Class<T>                  CLASS,
            null,               // final Predicate<JsonNumber>     jsonNumWillFit,
            null,               // final Predicate<String>         validStrTester,
            null,               // final Function<String, T>       defaultParser,
            null,               // final Function<Number, T>       numberConverter w/Approx,
            null                // final Function<BigDecimal, T>   numberConverter w/AEX
        );
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Three Minor Helper Predicates
    // ********************************************************************************************
    // ********************************************************************************************


    // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    // Long-Type Test-Predicate
    // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

    private static final BigInteger LONG_MAX = BigInteger.valueOf(Long.MAX_VALUE);
    private static final BigInteger LONG_MIN = BigInteger.valueOf(Long.MIN_VALUE);

    private static boolean longTypePred(JsonNumber jn)
    {
        if (! jn.isIntegral()) return false;

        BigInteger  bi      = jn.bigIntegerValue();
        int         signum  = bi.signum();

        return  ((signum > 0) && (bi.compareTo(LONG_MAX) <= 0))
            ||  ((signum < 0) && (bi.compareTo(LONG_MIN) >= 0))
            ||  (signum == 0);
    }


    // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    // Short-Type Test-Predicate
    // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

    private static final BigInteger SHORT_MAX   = BigInteger.valueOf(Short.MAX_VALUE);
    private static final BigInteger SHORT_MIN   = BigInteger.valueOf(Short.MIN_VALUE);

    private static boolean shortTypePred(JsonNumber jn)
    {
        if (! jn.isIntegral()) return false;

        BigInteger  bi      = jn.bigIntegerValue();
        int         signum  = bi.signum();

        return  ((signum > 0) && (bi.compareTo(SHORT_MAX) <= 0))
            ||  ((signum < 0) && (bi.compareTo(SHORT_MIN) >= 0))
            ||  (signum == 0);
    }


    // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    // Byte-Type Test-Predicate
    // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

    private static final BigInteger BYTE_MAX = BigInteger.valueOf(Byte.MAX_VALUE);
    private static final BigInteger BYTE_MIN = BigInteger.valueOf(Byte.MIN_VALUE);

    private static boolean byteTypePred(JsonNumber jn)
    {
        if (! jn.isIntegral()) return false;

        BigInteger  bi      = jn.bigIntegerValue();
        int         signum  = bi.signum();

        return  ((signum > 0) && (bi.compareTo(BYTE_MAX) <= 0))
            ||  ((signum < 0) && (bi.compareTo(BYTE_MIN) >= 0))
            ||  (signum == 0);
    }
}