Class ReadJSON


  • public class ReadJSON
    extends java.lang.Object
    Utilities that build on the J2EE Standard Release JSON Parsing Tool providing additional help with converting JSON Data into Java Data Types.

    This class builds on the J2EE Standard 'Glass-Fish' JSON Processor

    There are several JSON Parsers available, and even more implementations for serializing and de-serializing data to/from JSON. The tool included in the J2EE is available on GitHub, and that is the one used by the Java HTML JAR Library. (See: javax.json.* )

    Primary Classes Used: JsonArray and JsonObject

    The main goal of the methods in this class is simply to reduce the amount of code that needs to be written by a programmer when writing JSON De-Serializing Methods. For instance, when writing a Java Wrapper around a REST API (like the 'Facebook', 'YouTube', 'IMDB' or 'Twitter' API's), being able to write a constructor for Java Object that essentially needs just one line of code to assign each of the fields in the Java Object makes writing REST API POJO's a lot faster.

    If the JSON that your code is parsing is guaranteed to be free from nulls, missing properties, and incorrect types - then the vast majority of the methods in this class will not provide much additional benefit to your program. If your JSON data is definitively well-known, and well-understood, using the more basic features that are already availabe in the J2EE Json Parser should be enough! The features available in this class are here mainly to simplify handling all possibilities for error and unexpected-input that can happen when transmiting data with JSON.

    NOTE: There are JSON Packages available (for instance the 'Jackson' Suite of Tools) that have hundreds of classes for creating Java-Objects out of JSON Objects. However, their level of complexity (and ubiquitous use of annotations) can be so over-powering, that they sometimes seem unusable.

    Every one of the Java-Objects in the Headless-Browser / Chrome Remote Debugging A.P.I. have objects whose constructor's all use this 'ReadJSON' class to extract the Object Fields from the JSON Properties in just a few lines (Actually, the number of lines of code in each of the constructors in that package is exactly equal to the number of fields in each of the classes there.) For an example of the use of this class, please refer to any of the constructors or the commands inside the browser package.

    Example:
    public class Automobile
    {
        public final String     make;
        public final String     model
        public final short      year;
        public final Integer    miles;      // Boxed-Type "Integer" (capital 'I') ALLOWS NULL!
        public final Boolean    compact;    // Boxed-Type "Boolean" (capital 'B') ALLOWS NULL!
    
        public Automobile(JsonObject jo)
        {
            // The "Make" of the care is guaranteed.
            // THROWS: If Property is not available, null, or not a JsonString
            this.make = ReadJSON.getString(jo, "Manufacturer");
    
            // The "Model" of the car, isn't guaranteed.
            // THROWS:  Only if the property isn't a JsonString
            // RETURNS: 'null' if it is missing, or set to Json-Null
            this.model = ReadJSON.getString(jo, "Model", true, false);
    
            // The "Year" Property is also guaranteed. 
            // THROWS:  If missing, null, wrong-type (on all error cases)
            // RETURNS: The "Year" jo property-value
            this.year = ReadJSON.getShort(jo, "Year");
    
            // This is an optional "Miles" Property.
            // THROWS:  No exception is thrown if this property is missing or null
            //          If the property is the wrong-type (not a number), throws JsonTypeObjException
            // RETURNS: miles property-value, or the default-Value of '0' (if missing or null)
            this.miles = ReadJSON.getINTEGER(jo, "miles", RD_N | RD_M, 0);
        
            // Optional "compact" boolean property.
            // THROWS:  NEVER - even if missing, null, or not a Json-Boolean.
            // RETURNS: 'isCompact' property-value *or* auto-assigns null on error
            this.compact = ReadJSON.getBOOLEAN(jo, "isCompact", RETURN_NULL_ON_ANY_ALL, false);
        }
    
        public static void main(String[] argv) throws Exception
        {
            // Read and load JSON into a String, then to a 'JsonObject'
            String          json    = FileRW.loadFileToString("some-file.json");
            StringReader    sr      = new StringReader(json);
            JsonObject      jo      = Json.createReader(sr).readObject();
    
            // Build an "Automobile" Object instance
            Automobile auto = new Automobile(jo);
        }
    }
    
    See Also:
    Json, JsonObject, JsonArray


Stateless Class: This class neither contains any program-state, nor can it be instantiated. The @StaticFunctional Annotation may also be called 'The Spaghetti Report'. Static-Functional classes are, essentially, C-Styled Files, without any constructors or non-static member field. It is very similar to the Java-Bean @Stateless Annotation.
  • 1 Constructor(s), 1 declared private, zero-argument constructor
  • 64 Method(s), 64 declared static
  • 0 Field(s)


    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class
      static class  ReadJSON.XL
    • Method Summary

       
      Retrieve a JsonNumber from a JsonArray, and transform it to a Java Integer
      Returns Modifier and Type Method
      Primitive static int getInt​(JsonArray ja, int index)
      Boxed-Primitive static Integer getINTEGER​(JsonArray ja, int index)
      Boxed-Primitive static Integer getINTEGER​(JsonArray ja, int index, int FLAGS, int defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to a Java Integer
      Returns Modifier and Type Method
      Primitive static int getInt​(JsonObject jo, String propertyName)
      Boxed-Primitive static Integer getINTEGER​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Integer getINTEGER​(JsonObject jo, String propertyName, int FLAGS, int defaultValue)
       
      Retrieve a JsonNumber from a JsonArray, and transform it to a Java Long
      Returns Modifier and Type Method
      Primitive static long getLong​(JsonArray ja, int index)
      Boxed-Primitive static Long getLONG​(JsonArray ja, int index)
      Boxed-Primitive static Long getLONG​(JsonArray ja, int index, int FLAGS, long defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to a Java Long
      Returns Modifier and Type Method
      Primitive static long getLong​(JsonObject jo, String propertyName)
      Boxed-Primitive static Long getLONG​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Long getLONG​(JsonObject jo, String propertyName, int FLAGS, long defaultValue)
       
      Retrieve a JsonNumber from a JsonArray, and transform it to a Java Short
      Returns Modifier and Type Method
      Primitive static short getShort​(JsonArray ja, int index)
      Boxed-Primitive static Short getSHORT​(JsonArray ja, int index)
      Boxed-Primitive static Short getSHORT​(JsonArray ja, int index, int FLAGS, short defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to a Java Short
      Returns Modifier and Type Method
      Primitive static short getShort​(JsonObject jo, String propertyName)
      Boxed-Primitive static Short getSHORT​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Short getSHORT​(JsonObject jo, String propertyName, int FLAGS, short defaultValue)
       
      Retrieve a JsonNumber from a JsonArray, and transform it to a Java Byte
      Returns Modifier and Type Method
      Primitive static byte getByte​(JsonArray ja, int index)
      Boxed-Primitive static Byte getBYTE​(JsonArray ja, int index)
      Boxed-Primitive static Byte getBYTE​(JsonArray ja, int index, int FLAGS, byte defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to a Java Byte
      Returns Modifier and Type Method
      Primitive static byte getByte​(JsonObject jo, String propertyName)
      Boxed-Primitive static Byte getBYTE​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Byte getBYTE​(JsonObject jo, String propertyName, int FLAGS, byte defaultValue)
       
      Retrieve a JsonNumber from a JsonArray, and transform it to a Java Double
      Returns Modifier and Type Method
      Primitive static double getDouble​(JsonArray ja, int index)
      Boxed-Primitive static Double getDOUBLE​(JsonArray ja, int index)
      Boxed-Primitive static Double getDOUBLE​(JsonArray ja, int index, int FLAGS, double defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to a Java Double
      Returns Modifier and Type Method
      Primitive static double getDouble​(JsonObject jo, String propertyName)
      Boxed-Primitive static Double getDOUBLE​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Double getDOUBLE​(JsonObject jo, String propertyName, int FLAGS, double defaultValue)
       
      Retrieve a JsonNumber from a JsonArray, and transform it to a Java Float
      Returns Modifier and Type Method
      Primitive static float getFloat​(JsonArray ja, int index)
      Boxed-Primitive static Float getFLOAT​(JsonArray ja, int index)
      Boxed-Primitive static Float getFLOAT​(JsonArray ja, int index, int FLAGS, float defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to a Java Float
      Returns Modifier and Type Method
      Primitive static float getFloat​(JsonObject jo, String propertyName)
      Boxed-Primitive static Float getFLOAT​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Float getFLOAT​(JsonObject jo, String propertyName, int FLAGS, float defaultValue)
       
      Retrieve a JsonNumber from a JsonArray, and transform it to the appropriate Java Number
      Returns Modifier and Type Method
      Boxed-Primitive static Number getNUMBER​(JsonArray ja, int index, boolean throwOnNull)
      Boxed-Primitive static Number getNUMBER​(JsonArray ja, int index, int FLAGS, Number defaultValue)
       
      Retrieve a JsonNumber from a JsonObject, and transform it to the appropriate Java Number
      Returns Modifier and Type Method
      Boxed-Primitive static Number getNUMBER​(JsonObject jo, String propertyName, boolean isOptional, boolean throwOnNull)
      Boxed-Primitive static Number getNUMBER​(JsonObject jo, String propertyName, int FLAGS, Number defaultValue)
       
      Retrieve a JsonString from a JsonArray, and parse it to a Java-Number
      Returns Modifier and Type Method
      Boxed-Primitive static Byte parseBYTE​(JsonArray ja, int index, int FLAGS, byte defaultValue, Function<String,​Byte> optionalParser)
      Boxed-Primitive static Double parseDOUBLE​(JsonArray ja, int index, int FLAGS, double defaultValue, Function<String,​Double> optionalParser)
      Boxed-Primitive static Float parseFLOAT​(JsonArray ja, int index, int FLAGS, float defaultValue, Function<String,​Float> optionalParser)
      Boxed-Primitive static Integer parseINTEGER​(JsonArray ja, int index, int FLAGS, int defaultValue, Function<String,​Integer> optionalParser)
      Boxed-Primitive static Long parseLONG​(JsonArray ja, int index, int FLAGS, long defaultValue, Function<String,​Long> optionalParser)
      Boxed-Primitive static Number parseNUMBER​(JsonArray ja, int index, int FLAGS, Number defaultValue, Function<String,​Number> optionalParser)
      Boxed-Primitive static Short parseSHORT​(JsonArray ja, int index, int FLAGS, short defaultValue, Function<String,​Short> optionalParser)
       
      Retrieve a JsonString from a JsonObject, and parse it to a Java-Number
      Returns Modifier and Type Method
      Boxed-Primitive static Byte parseBYTE​(JsonObject jo, String propertyName, int FLAGS, byte defaultValue, Function<String,​Byte> optionalParser)
      Boxed-Primitive static Double parseDOUBLE​(JsonObject jo, String propertyName, int FLAGS, double defaultValue, Function<String,​Double> optionalParser)
      Boxed-Primitive static Float parseFLOAT​(JsonObject jo, String propertyName, int FLAGS, float defaultValue, Function<String,​Float> parser)
      Boxed-Primitive static Integer parseINTEGER​(JsonObject jo, String propertyName, int FLAGS, int defaultValue, Function<String,​Integer> optionalParser)
      Boxed-Primitive static Long parseLONG​(JsonObject jo, String propertyName, int FLAGS, long defaultValue, Function<String,​Long> optionalParser)
      Boxed-Primitive static Number parseNUMBER​(JsonObject jo, String propertyName, int FLAGS, Number defaultValue, Function<String,​Number> optionalParser)
      Boxed-Primitive static Short parseSHORT​(JsonObject jo, String propertyName, int FLAGS, short defaultValue, Function<String,​Short> optionalParser)
       
      Retrieve JsonValue.TRUE or FALSE, from a JsonArray, and transform it to a Java Boolean
      Returns Modifier and Type Method
      Primitive static boolean getBoolean​(JsonArray ja, int index)
      Boxed-Primitive static Boolean getBOOLEAN​(JsonArray ja, int index)
      Boxed-Primitive static Boolean getBOOLEAN​(JsonArray ja, int index, int FLAGS, boolean defaultValue)
       
      Retrieve JsonValue.TRUE or FALSE, from a JsonObject, and transform it to a Java Boolean
      Returns Modifier and Type Method
      Primitive static boolean getBoolean​(JsonObject jo, String propertyName)
      Boxed-Primitive static Boolean getBOOLEAN​(JsonObject jo, String propertyName, boolean isOptional)
      Boxed-Primitive static Boolean getBOOLEAN​(JsonObject jo, String propertyName, int FLAGS, boolean defaultValue)
       
      Retrieve a JsonString and parse it to a Java-Boolean
      Returns Modifier and Type Method
      Boxed-Primitive static Boolean parseBOOLEAN​(JsonArray ja, int index, int FLAGS, boolean defaultValue, Function<String,​Boolean> optionalParser)
      Boxed-Primitive static Boolean parseBOOLEAN​(JsonObject jo, String propertyName, int FLAGS, boolean defaultValue, Function<String,​Boolean> parser)
       
      Retrieve a JsonString, and transform it to a Java String
      Returns Modifier and Type Method
      String static String getString​(JsonArray ja, int index, boolean throwOnNull)
      String static String getString​(JsonObject jo, String propertyName, boolean isOptional, boolean throwOnNull)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInt

        🡇    
        public static int getInt​(JsonArray ja,
                                 int index)
        Retrieve a JsonArray element, and transform it to an 'int' primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type int, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber, and that element may be properly mapped to a Java int.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of intValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid int. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive int will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonArray, int, Class, Function), JsonNumber.intValueExact()
        Code:
        Exact Method Body:
         return GET(ja, index, int.class, JsonNumber::intValueExact);
        
      • getINTEGER

        🡅  🡇    
        public static java.lang.Integer getINTEGER​(JsonArray ja,
                                                   int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Integer. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type java.lang.Integer, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber. If that array-index contains some other type, or that JsonNumber cannot be properly transformed to a java.lang.Integer, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of intValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Integer. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        See Also:
        RJInternal.GET(JsonArray, int, Function, Class), JsonNumber.intValueExact()
        Code:
        Exact Method Body:
         return GET(ja, index, JsonNumber::intValueExact, Integer.class);
        
      • getINTEGER

        🡅  🡇    
        public static java.lang.Integer getINTEGER​(JsonArray ja,
                                                   int index,
                                                   int FLAGS,
                                                   int defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Integer. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method int​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.int​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Integer

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.getINTEGER(jsonArray, 1, RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the array index is null,
        // or if the array index contains some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Integer => 'int' primitive
        
        int val = ReadJSON.getINTEGER(jsonArray, 1, RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Integer, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Integer, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), JsonNumber.intValueExact(), JsonNumber.intValue()
        Code:
        Exact Method Body:
         return GET(
             ja, index, FLAGS, defaultValue,
             Integer.class, JsonNumber::intValueExact, JsonNumber::intValue
         );
        
      • parseINTEGER

        🡅  🡇    
        public static java.lang.Integer parseINTEGER​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     int defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Integer> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Integer, with either a user-provided parser, or the standard java integer parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.parseINTEGER(jsonArray, 1, RETURN_NULL_ON_NULL, -1, null);
        
        // The following invocation gracefully returns '-1' if the array index contains an
        // 'unparseable' String (or is null)
        // Note that Java's Type Inferencing auto-converts the java.lang.Integer => 'int' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX;
        int val = ReadJSON.parseINTEGER(jsonArray, 1, FLAGS, -1, null);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Integer.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Integer.parseInt(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Integer, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Integer, and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Integer, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Integer.class, optionalParser,
             BigDecimal::intValueExact, BigDecimal::intValue
         );
        
      • getInt

        🡅  🡇    
        public static int getInt​(JsonObject jo,
                                 java.lang.String propertyName)
        Extract a JsonObject property, and transform it to an 'int' primitive
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type int.
        Returns:
        An instance of Java-Type int, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber. Furthermore, that JsonNumber must be assignable to Java Primitive Type int, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonArithmeticObjException - Java's implementation of intValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid int. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive int will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonObject, String, Class, Function), JsonNumber.intValueExact()
        Code:
        Exact Method Body:
         return GET(jo, propertyName, int.class, JsonNumber::intValueExact);
        
      • getINTEGER

        🡅  🡇    
        public static java.lang.Integer getINTEGER​(JsonObject jo,
                                                   java.lang.String propertyName,
                                                   boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Integer. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Integer.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Integer, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonArithmeticObjException - Java's implementation of intValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Integer. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        RJInternal.GET(JsonObject, String, boolean, Function, Class), JsonNumber.intValueExact()
        Code:
        Exact Method Body:
         return GET(jo, propertyName, isOptional, JsonNumber::intValueExact, Integer.class);
        
      • getINTEGER

        🡅  🡇    
        public static java.lang.Integer getINTEGER​(JsonObject jo,
                                                   java.lang.String propertyName,
                                                   int FLAGS,
                                                   int defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Integer. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method int​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.int​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Integer

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.getINTEGER(jsonObj, "myProp", RETURN_NULL_ON_NULL -1);
        
        // The following invocation gracefully returns '-1' if the property contains a null,
        // or if the property holds some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Integer => 'int' primitive
        
        int val = ReadJSON.getINTEGER(jsonObj, "myProp", RETURN_DEFVAL_ON_NULL & RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Integer.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Integer, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Integer, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), JsonNumber.intValueExact(), JsonNumber.intValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, FLAGS, defaultValue,
             Integer.class, JsonNumber::intValueExact, JsonNumber::intValue
         );
        
      • parseINTEGER

        🡅  🡇    
        public static java.lang.Integer parseINTEGER​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     int defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Integer> optionalParser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Integer, with either a user-provided parser, or the standard java integer parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.parseINTEGER(jsonObj, "myProp", RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the property contains an
        // 'unparseable' String, or if it is null.
        // Note that Java's Type Inferencing auto-converts the java.lang.Integer => 'int' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX
        int val = ReadJSON.parseINTEGER(jsonObj, "myProp", FLAGS , -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Integer.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Integer.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Integer.parseInt(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Integer, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Integer, and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Integer, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Integer.class, optionalParser,
             BigDecimal::intValueExact, BigDecimal::intValue
         );
        
      • getLong

        🡅  🡇    
        public static long getLong​(JsonArray ja,
                                   int index)
        Retrieve a JsonArray element, and transform it to a 'long' primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type long, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber, and that element may be properly mapped to a Java long.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of longValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid long. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive long will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonArray, int, Class, Function), JsonNumber.longValueExact()
        Code:
        Exact Method Body:
         return GET(ja, index, long.class, JsonNumber::longValueExact);
        
      • getLONG

        🡅  🡇    
        public static java.lang.Long getLONG​(JsonArray ja,
                                             int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Long. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type java.lang.Long, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber. If that array-index contains some other type, or that JsonNumber cannot be properly transformed to a java.lang.Long, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of longValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Long. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        See Also:
        RJInternal.GET(JsonArray, int, Function, Class), JsonNumber.longValueExact()
        Code:
        Exact Method Body:
         return GET(ja, index, JsonNumber::longValueExact, Long.class);
        
      • getLONG

        🡅  🡇    
        public static java.lang.Long getLONG​(JsonArray ja,
                                             int index,
                                             int FLAGS,
                                             long defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Long. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method long​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.long​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Long

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        long val = ReadJSON.getLONG(jsonArray, 1, RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the array index is null,
        // or if the array index contains some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Long => 'long' primitive
        
        long val = ReadJSON.getLONG(jsonArray, 1, RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Long, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Long, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), JsonNumber.longValueExact(), JsonNumber.longValue()
        Code:
        Exact Method Body:
         return GET(
             ja, index, FLAGS, defaultValue,
             Long.class, JsonNumber::longValueExact, JsonNumber::longValue
         );
        
      • parseLONG

        🡅  🡇    
        public static java.lang.Long parseLONG​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     long defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Long> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Long, with either a user-provided parser, or the standard java long-integer parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        long val = ReadJSON.parseLONG(jsonArray, 1, RETURN_NULL_ON_NULL, -1, null);
        
        // The following invocation gracefully returns '-1' if the array index contains an
        // 'unparseable' String (or is null)
        // Note that Java's Type Inferencing auto-converts the java.lang.Long => 'long' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX;
        long val = ReadJSON.parseLONG(jsonArray, 1, FLAGS, -1, null);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Long.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Long.parseLong(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Long, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Long, and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Long, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Long.class, optionalParser,
             BigDecimal::longValueExact, BigDecimal::longValue
         );
        
      • getLong

        🡅  🡇    
        public static long getLong​(JsonObject jo,
                                   java.lang.String propertyName)
        Extract a JsonObject property, and transform it to a 'long' primitive
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type long.
        Returns:
        An instance of Java-Type long, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber. Furthermore, that JsonNumber must be assignable to Java Primitive Type long, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonArithmeticObjException - Java's implementation of longValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid long. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive long will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonObject, String, Class, Function), JsonNumber.longValueExact()
        Code:
        Exact Method Body:
         return GET(jo, propertyName, long.class, JsonNumber::longValueExact);
        
      • getLONG

        🡅  🡇    
        public static java.lang.Long getLONG​(JsonObject jo,
                                             java.lang.String propertyName,
                                             boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Long. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Long.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Long, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonArithmeticObjException - Java's implementation of longValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Long. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        RJInternal.GET(JsonObject, String, boolean, Function, Class), JsonNumber.longValueExact()
        Code:
        Exact Method Body:
         return GET(jo, propertyName, isOptional, JsonNumber::longValueExact, Long.class);
        
      • getLONG

        🡅  🡇    
        public static java.lang.Long getLONG​(JsonObject jo,
                                             java.lang.String propertyName,
                                             int FLAGS,
                                             long defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Long. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method int​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.int​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Long

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.getLONG(jsonObj, "myProp", RETURN_NULL_ON_NULL -1);
        
        // The following invocation gracefully returns '-1' if the property contains a null,
        // or if the property holds some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Long => 'int' primitive
        
        int val = ReadJSON.getLONG(jsonObj, "myProp", RETURN_DEFVAL_ON_NULL & RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Long.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Long, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Long, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), JsonNumber.longValueExact(), JsonNumber.longValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, FLAGS, defaultValue,
             Long.class, JsonNumber::longValueExact, JsonNumber::longValue
         );
        
      • parseLONG

        🡅  🡇    
        public static java.lang.Long parseLONG​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     long defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Long> optionalParser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Long, with either a user-provided parser, or the standard java long-integer parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        long val = ReadJSON.parseLONG(jsonObj, "myProp", RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the property contains an
        // 'unparseable' String, or if it is null.
        // Note that Java's Type Inferencing auto-converts the java.lang.Long => 'long' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX
        long val = ReadJSON.parseLONG(jsonObj, "myProp", FLAGS , -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Long.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Long.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Long.parseLong(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Long, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Long, and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Long, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Long.class, optionalParser,
             BigDecimal::longValueExact, BigDecimal::longValue
         );
        
      • getShort

        🡅  🡇    
        public static short getShort​(JsonArray ja,
                                     int index)
        Retrieve a JsonArray element, and transform it to a 'short' primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type short, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber, and that element may be properly mapped to a Java short.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of shortValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid short. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive short will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonArray, int, Class, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(ja, index, short.class, jn -> jn.bigDecimalValue().shortValueExact());
        
      • getSHORT

        🡅  🡇    
        public static java.lang.Short getSHORT​(JsonArray ja,
                                               int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Short. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type java.lang.Short, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber. If that array-index contains some other type, or that JsonNumber cannot be properly transformed to a java.lang.Short, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of shortValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Short. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        See Also:
        RJInternal.GET(JsonArray, int, Function, Class), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(ja, index, jn -> jn.bigDecimalValue().shortValueExact(), Short.class);
        
      • getSHORT

        🡅  🡇    
        public static java.lang.Short getSHORT​(JsonArray ja,
                                               int index,
                                               int FLAGS,
                                               short defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Short. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method short​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.short​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Short

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        short val = ReadJSON.getSHORT(jsonArray, 1, RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the array index is null,
        // or if the array index contains some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Short => 'short' primitive
        
        short val = ReadJSON.getSHORT(jsonArray, 1, RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Short, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Short, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             ja, index, FLAGS, defaultValue, Short.class,
             jn -> jn.bigDecimalValue().shortValueExact(),
             jn -> jn.bigDecimalValue().shortValue()
         );
        
      • parseSHORT

        🡅  🡇    
        public static java.lang.Short parseSHORT​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     short defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Short> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Short, with either a user-provided parser, or the standard java short-integer parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        short val = ReadJSON.parseSHORT(jsonArray, 1, RETURN_NULL_ON_NULL, -1, null);
        
        // The following invocation gracefully returns '-1' if the array index contains an
        // 'unparseable' String (or is null)
        // Note that Java's Type Inferencing auto-converts the java.lang.Short => 'short' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX;
        short val = ReadJSON.parseSHORT(jsonArray, 1, FLAGS, -1, null);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Short.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Short.parseShort(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Short, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Short, and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Short, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Short.class, optionalParser,
             BigDecimal::shortValueExact, BigDecimal::shortValue
         );
        
      • getShort

        🡅  🡇    
        public static short getShort​(JsonObject jo,
                                     java.lang.String propertyName)
        Extract a JsonObject property, and transform it to a 'short' primitive
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type short.
        Returns:
        An instance of Java-Type short, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber. Furthermore, that JsonNumber must be assignable to Java Primitive Type short, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonArithmeticObjException - Java's implementation of shortValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid short. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive short will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonObject, String, Class, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(jo, propertyName, short.class, jn -> jn.bigDecimalValue().shortValueExact());
        
      • getSHORT

        🡅  🡇    
        public static java.lang.Short getSHORT​(JsonObject jo,
                                               java.lang.String propertyName,
                                               boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Short. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Short.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Short, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonArithmeticObjException - Java's implementation of shortValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Short. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        RJInternal.GET(JsonObject, String, boolean, Function, Class), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, isOptional, jn -> jn.bigDecimalValue().shortValueExact(),
             Short.class
         );
        
      • getSHORT

        🡅  🡇    
        public static java.lang.Short getSHORT​(JsonObject jo,
                                               java.lang.String propertyName,
                                               int FLAGS,
                                               short defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Short. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method int​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.int​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Short

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.getSHORT(jsonObj, "myProp", RETURN_NULL_ON_NULL -1);
        
        // The following invocation gracefully returns '-1' if the property contains a null,
        // or if the property holds some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Short => 'int' primitive
        
        int val = ReadJSON.getSHORT(jsonObj, "myProp", RETURN_DEFVAL_ON_NULL & RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Short.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Short, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Short, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, FLAGS, defaultValue, Short.class,
             jn -> jn.bigDecimalValue().shortValueExact(),
             jn -> jn.bigDecimalValue().shortValue()
         );
        
      • parseSHORT

        🡅  🡇    
        public static java.lang.Short parseSHORT​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     short defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Short> optionalParser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Short, with either a user-provided parser, or the standard java short-integer parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        short val = ReadJSON.parseSHORT(jsonObj, "myProp", RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the property contains an
        // 'unparseable' String, or if it is null.
        // Note that Java's Type Inferencing auto-converts the java.lang.Short => 'short' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX
        short val = ReadJSON.parseSHORT(jsonObj, "myProp", FLAGS , -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Short.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Short.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Short.parseShort(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Short, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Short, and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Short, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Short.class, optionalParser,
             BigDecimal::shortValueExact, BigDecimal::shortValue
         );
        
      • getByte

        🡅  🡇    
        public static byte getByte​(JsonArray ja,
                                   int index)
        Retrieve a JsonArray element, and transform it to a 'byte' primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type byte, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber, and that element may be properly mapped to a Java byte.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of byteValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid byte. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive byte will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonArray, int, Class, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(ja, index, byte.class, jn -> jn.bigDecimalValue().byteValueExact());
        
      • getBYTE

        🡅  🡇    
        public static java.lang.Byte getBYTE​(JsonArray ja,
                                             int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Byte. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type java.lang.Byte, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber. If that array-index contains some other type, or that JsonNumber cannot be properly transformed to a java.lang.Byte, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of byteValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Byte. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        See Also:
        RJInternal.GET(JsonArray, int, Function, Class), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(ja, index, jn -> jn.bigDecimalValue().byteValueExact(), Byte.class);
        
      • getBYTE

        🡅  🡇    
        public static java.lang.Byte getBYTE​(JsonArray ja,
                                             int index,
                                             int FLAGS,
                                             byte defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Byte. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method byte​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.byte​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Byte

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        byte val = ReadJSON.getBYTE(jsonArray, 1, RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the array index is null,
        // or if the array index contains some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Byte => 'byte' primitive
        
        byte val = ReadJSON.getBYTE(jsonArray, 1, RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Byte, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Byte, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             ja, index, FLAGS, defaultValue, Byte.class,
             jn -> jn.bigDecimalValue().byteValueExact(),
             jn -> jn.bigDecimalValue().byteValue()
         );
        
      • parseBYTE

        🡅  🡇    
        public static java.lang.Byte parseBYTE​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     byte defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Byte> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Byte, with either a user-provided parser, or the standard java byte parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        byte val = ReadJSON.parseBYTE(jsonArray, 1, RETURN_NULL_ON_NULL, -1, null);
        
        // The following invocation gracefully returns '-1' if the array index contains an
        // 'unparseable' String (or is null)
        // Note that Java's Type Inferencing auto-converts the java.lang.Byte => 'byte' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX;
        byte val = ReadJSON.parseBYTE(jsonArray, 1, FLAGS, -1, null);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Byte.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Byte.parseByte(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Byte, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Byte, and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Byte, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Byte.class, optionalParser,
             BigDecimal::byteValueExact, BigDecimal::byteValue
         );
        
      • getByte

        🡅  🡇    
        public static byte getByte​(JsonObject jo,
                                   java.lang.String propertyName)
        Extract a JsonObject property, and transform it to a 'byte' primitive
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type byte.
        Returns:
        An instance of Java-Type byte, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber. Furthermore, that JsonNumber must be assignable to Java Primitive Type byte, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonArithmeticObjException - Java's implementation of byteValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid byte. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive byte will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonObject, String, Class, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(jo, propertyName, byte.class, jn -> jn.bigDecimalValue().byteValueExact());
        
      • getBYTE

        🡅  🡇    
        public static java.lang.Byte getBYTE​(JsonObject jo,
                                             java.lang.String propertyName,
                                             boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Byte. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Byte.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Byte, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonArithmeticObjException - Java's implementation of byteValueExact() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Byte. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        RJInternal.GET(JsonObject, String, boolean, Function, Class), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, isOptional, jn -> jn.bigDecimalValue().byteValueExact(),
             Byte.class
         );
        
      • getBYTE

        🡅  🡇    
        public static java.lang.Byte getBYTE​(JsonObject jo,
                                             java.lang.String propertyName,
                                             int FLAGS,
                                             byte defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Byte. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method int​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.int​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Byte

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.getBYTE(jsonObj, "myProp", RETURN_NULL_ON_NULL -1);
        
        // The following invocation gracefully returns '-1' if the property contains a null,
        // or if the property holds some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Byte => 'int' primitive
        
        int val = ReadJSON.getBYTE(jsonObj, "myProp", RETURN_DEFVAL_ON_NULL & RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Byte.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Byte, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Byte, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, FLAGS, defaultValue, Byte.class,
             jn -> jn.bigDecimalValue().byteValueExact(),
             jn -> jn.bigDecimalValue().byteValue()
         );
        
      • parseBYTE

        🡅  🡇    
        public static java.lang.Byte parseBYTE​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     byte defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Byte> optionalParser)
        
        Retrieve a JsonObject element containing a JsonString, and transform it to a java.lang.Byte, with either a user-provided parser, or the standard java byte parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        byte val = ReadJSON.parseBYTE(jsonObj, "myProp", RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the property contains an
        // 'unparseable' String, or if it is null.
        // Note that Java's Type Inferencing auto-converts the java.lang.Byte => 'byte' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX
        byte val = ReadJSON.parseBYTE(jsonObj, "myProp", FLAGS , -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Byte.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Byte.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Byte.parseByte(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Byte, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Byte, and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Byte, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Byte.class, optionalParser,
             BigDecimal::byteValueExact, BigDecimal::byteValue
         );
        
      • getDouble

        🡅  🡇    
        public static double getDouble​(JsonArray ja,
                                       int index)
        Retrieve a JsonArray element, and transform it to a 'double' primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type double, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber, and that element may be properly mapped to a Java double.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of BigDecimal.doubleValue() will return an infinity constant (Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type double.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive double will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonArray, int, Class, Function), RJInternal.DOUBLE_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(ja, index, double.class, RJInternal::DOUBLE_WITH_CHECK);
        
      • getDOUBLE

        🡅  🡇    
        public static java.lang.Double getDOUBLE​(JsonArray ja,
                                                 int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Double. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type java.lang.Double, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber. If that array-index contains some other type, or that JsonNumber cannot be properly transformed to a java.lang.Double, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of BigDecimal.doubleValue() will return an infinity constant (Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type java.lang.Double.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        See Also:
        RJInternal.GET(JsonArray, int, Function, Class), RJInternal.DOUBLE_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(ja, index, RJInternal::DOUBLE_WITH_CHECK, Double.class);
        
      • getDOUBLE

        🡅  🡇    
        public static java.lang.Double getDOUBLE​(JsonArray ja,
                                                 int index,
                                                 int FLAGS,
                                                 double defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Double. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method double​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.double​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Double

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        double val = ReadJSON.getDOUBLE(jsonArray, 1, RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the array index is null,
        // or if the array index contains some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Double => 'double' primitive
        
        double val = ReadJSON.getDOUBLE(jsonArray, 1, RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Double, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Double, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), RJInternal.DOUBLE_WITH_CHECK(JsonNumber), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             ja, index, FLAGS, defaultValue, Double.class,
             RJInternal::DOUBLE_WITH_CHECK, jn -> jn.bigDecimalValue().doubleValue()
         );
        
      • parseDOUBLE

        🡅  🡇    
        public static java.lang.Double parseDOUBLE​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     double defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Double> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Double, with either a user-provided parser, or the standard java double parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        double val = ReadJSON.parseDOUBLE(jsonArray, 1, RETURN_NULL_ON_NULL, -1, null);
        
        // The following invocation gracefully returns '-1' if the array index contains an
        // 'unparseable' String (or is null)
        // Note that Java's Type Inferencing auto-converts the java.lang.Double => 'double' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX;
        double val = ReadJSON.parseDOUBLE(jsonArray, 1, FLAGS, -1, null);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Double.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Double.parseDouble(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Double, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Double, and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Double, and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Double, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Double.class, optionalParser,
             RJInternal::DOUBLE_WITH_CHECK, BigDecimal::doubleValue
         );
        
      • getDouble

        🡅  🡇    
        public static double getDouble​(JsonObject jo,
                                       java.lang.String propertyName)
        Extract a JsonObject property, and transform it to a 'double' primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type double.
        Returns:
        An instance of Java-Type double, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber. Furthermore, that JsonNumber must be assignable to Java Primitive Type double, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonArithmeticObjException - Java's implementation of BigDecimal.doubleValue() will return an infinity constant (Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type double.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive double will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonObject, String, Class, Function), RJInternal.DOUBLE_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(jo, propertyName, double.class, RJInternal::DOUBLE_WITH_CHECK);
        
      • getDOUBLE

        🡅  🡇    
        public static java.lang.Double getDOUBLE​(JsonObject jo,
                                                 java.lang.String propertyName,
                                                 boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Double. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Double.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Double, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonArithmeticObjException - Java's implementation of BigDecimal.doubleValue() will return an infinity constant (Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type java.lang.Double.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        RJInternal.GET(JsonObject, String, boolean, Function, Class), RJInternal.DOUBLE_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(jo, propertyName, isOptional, RJInternal::DOUBLE_WITH_CHECK, Double.class);
        
      • getDOUBLE

        🡅  🡇    
        public static java.lang.Double getDOUBLE​(JsonObject jo,
                                                 java.lang.String propertyName,
                                                 int FLAGS,
                                                 double defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Double. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method double​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.double​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Double

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        double val = ReadJSON.getDOUBLE(jsonObj, "myProp", RETURN_NULL_ON_NULL -1);
        
        // The following invocation gracefully returns '-1' if the property contains a null,
        // or if the property holds some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Double => 'double' primitive
        
        double val = ReadJSON.getDOUBLE(jsonObj, "myProp", RETURN_DEFVAL_ON_NULL & RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Double.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Double, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - Java's implementation of doubleValue() throws an ArithmeticException when that method cannot correctly transform / convert the element to a valid java.lang.Double. The thrown-exception is then wrapped into this exception for the purpose of providing a much improved error-message, and convenience fields.
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), RJInternal.DOUBLE_WITH_CHECK(JsonNumber), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, FLAGS, defaultValue, Double.class,
             RJInternal::DOUBLE_WITH_CHECK, jn -> jn.bigDecimalValue().doubleValue()
         );
        
      • parseDOUBLE

        🡅  🡇    
        public static java.lang.Double parseDOUBLE​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     double defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Double> optionalParser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Double, with either a user-provided parser, or the standard java double parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        double val = ReadJSON.parseDOUBLE(jsonObj, "myProp", RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the property contains an
        // 'unparseable' String, or if it is null.
        // Note that Java's Type Inferencing auto-converts the java.lang.Double => 'double' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX
        double val = ReadJSON.parseDOUBLE(jsonObj, "myProp", FLAGS , -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Double.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Double.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Double.parseDouble(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Double, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Double, and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Double, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Double.class, optionalParser,
             RJInternal::DOUBLE_WITH_CHECK, BigDecimal::doubleValue
         );
        
      • getFloat

        🡅  🡇    
        public static float getFloat​(JsonArray ja,
                                     int index)
        Retrieve a JsonArray element, and transform it to a 'float' primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type float, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber, and that element may be properly mapped to a Java float.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of BigDecimal.floatValue() will return an infinity constant (Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type float.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive float will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonArray, int, Class, Function), RJInternal.FLOAT_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(ja, index, float.class, RJInternal::FLOAT_WITH_CHECK);
        
      • getFLOAT

        🡅  🡇    
        public static java.lang.Float getFLOAT​(JsonArray ja,
                                               int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Float. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        Returns:
        An instance of Java-Type java.lang.Float, if and only if the array element located at 'index' uses the appropriate Json-Type - JsonNumber. If that array-index contains some other type, or that JsonNumber cannot be properly transformed to a java.lang.Float, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonArithmeticArrException - Java's implementation of BigDecimal.floatValue() will return an infinity constant (Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type java.lang.Float.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        See Also:
        RJInternal.GET(JsonArray, int, Function, Class), RJInternal.FLOAT_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(ja, index, RJInternal::FLOAT_WITH_CHECK, Float.class);
        
      • getFLOAT

        🡅  🡇    
        public static java.lang.Float getFLOAT​(JsonArray ja,
                                               int index,
                                               int FLAGS,
                                               float defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Float. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method float​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.float​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Float

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        float val = ReadJSON.getFLOAT(jsonArray, 1, RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the array index is null,
        // or if the array index contains some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Float => 'float' primitive
        
        float val = ReadJSON.getFLOAT(jsonArray, 1, RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Float, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Float, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), RJInternal.FLOAT_WITH_CHECK(JsonNumber), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             ja, index, FLAGS, defaultValue, Float.class,
             RJInternal::FLOAT_WITH_CHECK, jn -> jn.bigDecimalValue().floatValue()
         );
        
      • parseFLOAT

        🡅  🡇    
        public static java.lang.Float parseFLOAT​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     float defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Float> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Float, with either a user-provided parser, or the standard java float parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        float val = ReadJSON.parseFLOAT(jsonArray, 1, RETURN_NULL_ON_NULL, -1, null);
        
        // The following invocation gracefully returns '-1' if the array index contains an
        // 'unparseable' String (or is null)
        // Note that Java's Type Inferencing auto-converts the java.lang.Float => 'float' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX;
        float val = ReadJSON.parseFLOAT(jsonArray, 1, FLAGS, -1, null);
        
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Float.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Float.parseFloat(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Float, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonArithmeticArrException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Float, and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Float, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Float.class, optionalParser,
             RJInternal::FLOAT_WITH_CHECK, BigDecimal::floatValue
         );
        
      • getFloat

        🡅  🡇    
        public static float getFloat​(JsonObject jo,
                                     java.lang.String propertyName)
        Extract a JsonObject property, and transform it to a 'float' primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type float.
        Returns:
        An instance of Java-Type float, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber. Furthermore, that JsonNumber must be assignable to Java Primitive Type float, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonArithmeticObjException - Java's implementation of BigDecimal.floatValue() will return an infinity constant (Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type float.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive float will not accept 'null' as a value).
        See Also:
        RJInternal.GET(JsonObject, String, Class, Function), RJInternal.FLOAT_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(jo, propertyName, float.class, RJInternal::FLOAT_WITH_CHECK);
        
      • getFLOAT

        🡅  🡇    
        public static java.lang.Float getFLOAT​(JsonObject jo,
                                               java.lang.String propertyName,
                                               boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Float. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive

        NOTE: If the precision of the provided JsonNumber contains too much information, the extra digits will simply be lost; no exceptions will throw; and the method shall return a rounded answer - gracefully.

        If the magnitude of the number is too large or too small, an ArithmeticException will throw, as explained below.
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Float.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Float, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonArithmeticObjException - Java's implementation of BigDecimal.floatValue() will return an infinity constant (Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY) when the magnitude of the returned value is too large to fit inside the Java Type java.lang.Float.

        This method checks for the infinity constants, and then proceeds to throw this exception when they are detected.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        RJInternal.GET(JsonObject, String, boolean, Function, Class), RJInternal.FLOAT_WITH_CHECK(JsonNumber)
        Code:
        Exact Method Body:
         return GET(jo, propertyName, isOptional, RJInternal::FLOAT_WITH_CHECK, Float.class);
        
      • getFLOAT

        🡅  🡇    
        public static java.lang.Float getFLOAT​(JsonObject jo,
                                               java.lang.String propertyName,
                                               int FLAGS,
                                               float defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Float. Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value (using the Flags). Additionally, if an ArithmeticException should throw, that exception-case can also be handled by using the default type-rounding mechanism java provides via method int​Value() (without the 'Exact' word appended to the method-name). See the Java Documentation for BigDecimal.int​Value() for an explanation about the behavior of flag RETURN_JAPPROX_ON_AEX and rounding a java.lang.Float

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        int val = ReadJSON.getFLOAT(jsonObj, "myProp", RETURN_NULL_ON_NULL -1);
        
        // The following invocation gracefully returns '-1' if the property contains a null,
        // or if the property holds some non-integer number.
        // Note that Type Inferencing auto-converts the returned java.lang.Float => 'int' primitive
        
        int val = ReadJSON.getFLOAT(jsonObj, "myProp", RETURN_DEFVAL_ON_NULL & RETURN_DEFVAL_ON_AEX, -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Float.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Float, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonNumber into a java.lang.Float, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), RJInternal.FLOAT_WITH_CHECK(JsonNumber), JsonNumber.bigDecimalValue()
        Code:
        Exact Method Body:
         return GET(
             jo, propertyName, FLAGS, defaultValue, Float.class,
             RJInternal::FLOAT_WITH_CHECK, jn -> jn.bigDecimalValue().floatValue()
         );
        
      • parseFLOAT

        🡅  🡇    
        public static java.lang.Float parseFLOAT​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     float defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Float> parser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Float, with either a user-provided parser, or the standard java float parser Please see the class documentation for JFlag for details about the error-handling flags provided by this method. Note that using the (lesser-known) Java-Syntax below, the flag-constants may be referenced without typing their full names at each use:

        // Note the use of the 'static' modifier here
        import static Torello.Java.Additional.JFlag.*;
        


        This method allows for many type-transformaton errors to be handled by converting the returned answer into either Java-Null, or a user-provided default-value, using the 'FLAGS' parameter.

        NOTE: Java's compile-time type-magic allows a user to assign this method's Boxed-Type return-value to its matching Primitive Type (It is called automatic boxing and unboxing).

        Just make sure to remember that if this method does return null because of erroneous JSON, and because the germaine Exception-Flags aren't set, your code would throw a NullPointerException! Compile Time Type Inferencing allows for:

        Example:
        // If null is actually returned, this would throw NullPointerException
        float val = ReadJSON.parseFLOAT(jsonObj, "myProp", RETURN_NULL_ON_NULL, -1);
        
        // The following invocation gracefully returns '-1' if the property contains an
        // 'unparseable' String, or if it is null.
        // Note that Java's Type Inferencing auto-converts the java.lang.Float => 'float' primitive
        
        int FLAGS = RETURN_DEFVAL_ON_NULL | RETURN_DEFVAL_ON_PARSEX
        float val = ReadJSON.parseFLOAT(jsonObj, "myProp", FLAGS , -1);
        
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Float.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        parser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Float.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Float.parseFloat(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Float, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonArithmeticObjException - If the number converstion function throws an ArithmeticException while attempting to convert the JsonString into a java.lang.Float, and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Float, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Float.class, parser,
             RJInternal::FLOAT_WITH_CHECK, BigDecimal::floatValue
         );
        
      • getNUMBER

        🡅  🡇    
        public static java.lang.Number getNUMBER​(JsonArray ja,
                                                 int index,
                                                 boolean throwOnNull)
        Retrieve a JsonArray element, and transform it to a java.lang.Number. There are several possible Boxed-Type subclasses of java.lang.Number which may be returned from this method. This method makes an effort to return the most appropriate subclass based on the value of the JsonNumber. Note that if the number is too large to fit into the standard boxed-types, an instance of java.lang.BigInteger or BigDecimal is returned, instead.

        If a call to JsonNumber.isIntegral() evaluates to TRUE, then one of the following types listed below is returned. The method BigInteger.bitLength() is used to determine which of these is used.

        • java.lang.Integer (The number uses 32 bits or less)
        • java.lang.Long (The number uses 64 bits or less)
        • java.math.BigInteger


        If the call to isIntegral() returns FALSE, then one of these types is returned:

        • java.lang.Float
        • java.lang.Double
        • java.math.BigDecimal
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonNumber
        throwOnNull - When TRUE is passed to this parameter, if the JsonArray element located at 'index' contains Json-Null, then this method will throw a JsonNullArrException. When this parameter is FALSE, if the specified array element contains Json-Null, then Java-Null is returned.
        Returns:
        An instance of Java-Type java.lang.Number, if the 'ja' array element located at 'index' uses the appropriate Json-Type - JsonNumber.

        If the specified array element contains Json-Null, and 'throwOnNull' has been passed FALSE, then Java-Null is returned. If the element is null, and 'throwOnNull' is TRUE, then a JsonNullArrException throws.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullArrException - If the JsonArray element specified by 'index' contains a Json-Null, and TRUE has been passed to 'throwOnNull'
        See Also:
        JsonValue.getValueType(), RJInternal.convertToNumber(JsonNumber)
        Code:
        Exact Method Body:
         // This will throw an IndexOutOfBoundsException if the index is out of bounds.
         JsonValue jv = ja.get(index);
        
         switch (jv.getValueType())
         {
             case NULL:
        
                 // This is simple-stuff (not rocket-science).  "Type Mapping" Code has to worry
                 // about what the meaning of "null" should be.
        
                 if (throwOnNull) throw new JsonNullArrException(ja, index, NUMBER, Number.class);
                 else return null;
        
             case NUMBER: return convertToNumber((JsonNumber) jv);
        
             // The JsonValue at the specified array-index does not contain a JsonString.
             default: throw new JsonTypeArrException(ja, index, NUMBER, jv, Number.class);
         }
        
      • getNUMBER

        🡅  🡇    
        public static java.lang.Number getNUMBER​(JsonArray ja,
                                                 int index,
                                                 int FLAGS,
                                                 java.lang.Number defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Number. There are several possible Boxed-Type subclasses of java.lang.Number which may be returned from this method. This method makes an effort to return the most appropriate subclass based on the value of the JsonNumber. Note that if the number is too large to fit into the standard boxed-types, an instance of java.lang.BigInteger or BigDecimal is returned, instead.

        If a call to JsonNumber.isIntegral() evaluates to TRUE, then one of the following types listed below is returned. The method BigInteger.bitLength() is used to determine which of these is used.

        • java.lang.Integer (The number uses 32 bits or less)
        • java.lang.Long (The number uses 64 bits or less)
        • java.math.BigInteger


        If the call to isIntegral() returns FALSE, then one of these types is returned:

        • java.lang.Float
        • java.lang.Double
        • java.math.BigDecimal
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Number, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonArray, int, int, Number, Class, Function, Function), RJInternal.convertToNumber(JsonNumber)
        Code:
        Exact Method Body:
         return GET(ja, index, FLAGS, defaultValue, Number.class, RJInternal::convertToNumber, null);
        
      • parseNUMBER

        🡅  🡇    
        public static java.lang.Number parseNUMBER​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     java.lang.Number defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Number> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Number, with either a user-provided parser, or the standard java parser

        If 'parser' is passed null, the default parser is used, which is just the java.math.BigDecimal constructor which accepts a String. What is done with the parsed BigDecimal instance is explained below.

        There are several possible Boxed-Type subclasses of java.lang.Number which may be returned from this method. This method makes an effort to return the most appropriate subclass based on the value of the JsonNumber. Note that if the number is too large to fit into the standard boxed-types, an instance of java.lang.BigInteger or BigDecimal is returned, instead.

        If a call to BigDecimal.scale() returns '0' then one of the following types listed below is returned. The method BigInteger.bitLength() is used to determine which of these is used.

        • java.lang.Integer (The number uses 32 bits or less)
        • java.lang.Long (The number uses 64 bits or less)
        • java.math.BigInteger


        Otherwise, one of these types is returned:

        • java.lang.Float
        • java.lang.Double
        • java.math.BigDecimal
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Number.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of new BigDecimal(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Number, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Number, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function), RJInternal.convertToNumber(String)
        Code:
        Exact Method Body:
         return PARSE(
             ja, index, FLAGS, defaultValue, Number.class, optionalParser,
             RJInternal::convertToNumber, null  /* Not Needed, convertToNumber won't throw */
         );
        
      • getNUMBER

        🡅  🡇    
        public static java.lang.Number getNUMBER​(JsonObject jo,
                                                 java.lang.String propertyName,
                                                 boolean isOptional,
                                                 boolean throwOnNull)
        Extract a JsonObject property, and transform it to a java.lang.Number. There are several possible Boxed-Type subclasses of java.lang.Number which may be returned from this method. This method makes an effort to return the most appropriate subclass based on the value of the JsonNumber. Note that if the number is too large to fit into the standard boxed-types, an instance of java.lang.BigInteger or BigDecimal is returned, instead.

        If a call to JsonNumber.isIntegral() evaluates to TRUE, then one of the following types listed below is returned. The method BigInteger.bitLength() is used to determine which of these is used.

        • java.lang.Integer (The number uses 32 bits or less)
        • java.lang.Long (The number uses 64 bits or less)
        • java.math.BigInteger


        If the call to isIntegral() returns FALSE, then one of these types is returned:

        • java.lang.Float
        • java.lang.Double
        • java.math.BigDecimal
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Number.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        throwOnNull - When TRUE is passed to this parameter, if the JsonObject property named 'propertyName' evaluates to Json-Null, then this method will throw a JsonNullObjException. When this parameter is FALSE, if the specified property contains Json-Null, then Java-Null is returned.
        Returns:
        An instance of Java-Type java.lang.Number', if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonNumber.

        If the specified property contains Json-Null, and 'throwOnNull' has been passed FALSE, then Java-Null is returned. If the property is null, and 'throwOnNull' is TRUE, then a JsonNullObjException throws.

        If the specified property is simply missing, Java-Null is returned, unless 'isOptional' has been passed FALSE - in which case a JsonPropMissingException shall be thrown.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonNumber (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains a Json-Null, and TRUE has been passed to 'throwOnNull'
        See Also:
        JsonValue.getValueType(), RJInternal.convertToNumber(JsonNumber)
        Code:
        Exact Method Body:
         if (! jo.containsKey(propertyName))
         {
             if (isOptional) return null;
             else throw new JsonPropMissingException(jo, propertyName, NUMBER, Number.class);
         }
        
         JsonValue jv = jo.get(propertyName);
        
         switch (jv.getValueType())
         {
             case NULL:
        
                 // This is simple-stuff (not rocket-science).  "Type Mapping" Code has to worry
                 // about what the meaning of "null" should be.
        
                 if (throwOnNull) throw new JsonNullObjException
                     (jo, propertyName, NUMBER, Number.class);
        
                 else return null;
        
             case NUMBER: return convertToNumber((JsonNumber) jv);
        
             // The JsonObject propertydoes not contain a JsonNumber.
             default: throw new JsonTypeObjException
                 (jo, propertyName, NUMBER, jv, Number.class);
         }
        
      • getNUMBER

        🡅  🡇    
        public static java.lang.Number getNUMBER​(JsonObject jo,
                                                 java.lang.String propertyName,
                                                 int FLAGS,
                                                 java.lang.Number defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Number. There are several possible Boxed-Type subclasses of java.lang.Number which may be returned from this method. This method makes an effort to return the most appropriate subclass based on the value of the JsonNumber. Note that if the number is too large to fit into the standard boxed-types, an instance of java.lang.BigInteger or BigDecimal is returned, instead.

        If a call to JsonNumber.isIntegral() evaluates to TRUE, then one of the following types listed below is returned. The method BigInteger.bitLength() is used to determine which of these is used.

        • java.lang.Integer (The number uses 32 bits or less)
        • java.lang.Long (The number uses 64 bits or less)
        • java.math.BigInteger


        If the call to isIntegral() returns FALSE, then one of these types is returned:

        • java.lang.Float
        • java.lang.Double
        • java.math.BigDecimal
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Number.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Number, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonNumber, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonNumber, and none of these Exception-Flags are set:
        See Also:
        RJInternal.GET(JsonObject, String, int, Number, Class, Function, Function), RJInternal.convertToNumber(JsonNumber)
        Code:
        Exact Method Body:
         return GET
             (jo, propertyName, FLAGS, defaultValue, Number.class, RJInternal::convertToNumber, null);
        
      • parseNUMBER

        🡅  🡇    
        public static java.lang.Number parseNUMBER​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     java.lang.Number defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Number> optionalParser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Number, with either a user-provided parser, or the standard java parser

        If 'parser' is passed null, the default parser is used, which is just the java.math.BigDecimal constructor which accepts a String. What is done with the parsed BigDecimal instance is explained below.

        There are several possible Boxed-Type subclasses of java.lang.Number which may be returned from this method. This method makes an effort to return the most appropriate subclass based on the value of the JsonNumber. Note that if the number is too large to fit into the standard boxed-types, an instance of java.lang.BigInteger or BigDecimal is returned, instead.

        If a call to BigDecimal.scale() returns '0' then one of the following types listed below is returned. The method BigInteger.bitLength() is used to determine which of these is used.

        • java.lang.Integer (The number uses 32 bits or less)
        • java.lang.Long (The number uses 64 bits or less)
        • java.math.BigInteger


        Otherwise, one of these types is returned:

        • java.lang.Float
        • java.lang.Double
        • java.math.BigDecimal
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Number.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Number.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of new BigDecimal(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Number, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Number, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        See Also:
        RJInternal.PARSE(JsonObject, String, int, Number, Class, Function, Function, Function), RJInternal.convertToNumber(String)
        Code:
        Exact Method Body:
         return PARSE(
             jo, propertyName, FLAGS, defaultValue, Number.class, optionalParser,
             RJInternal::convertToNumber, null /* Not Needed, convertToNumber won't throw */
         );
        
      • getBoolean

        🡅  🡇    
        public static boolean getBoolean​(JsonArray ja,
                                         int index)
        Retrieve a JsonArray element, and transform it to a 'boolean' primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JSON-BOOLEAN
        Returns:
        An instance of Java-Type boolean, if and only if the array element located at 'index' uses the appropriate Json-Type - JSON-BOOLEAN, and that element may be properly mapped to a Java boolean.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JSON-BOOLEAN (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveArrException - If 'index' specifies an element inside 'ja' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive boolean will not accept 'null' as a value).
        See Also:
        getBOOLEAN(JsonArray, int)
        Code:
        Exact Method Body:
         // This method (defined below) allows for null-returns, but "getBoolean" does not.  
         // "getBOOLEAN" will only return null if the actual array location 'index' actually has
         // the word 'null' listed.
        
         Boolean ret = getBOOLEAN(ja, index);
        
         // In that case, throw the Null-Primitive Exception
         if (ret == null) throw new JsonNullPrimitiveArrException
                 (ja, index, TRUE, boolean.class);
        
         return ret;
        
      • getBOOLEAN

        🡅  🡇    
        public static java.lang.Boolean getBOOLEAN​(JsonArray ja,
                                                   int index)
        Retrieve a JsonArray element, and transform it to a java.lang.Boolean. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JSON-BOOLEAN
        Returns:
        An instance of Java-Type java.lang.Boolean, if and only if the array element located at 'index' uses the appropriate Json-Type - JSON-BOOLEAN. If that array-index contains some other type, or that JSON-BOOLEAN cannot be properly transformed to a java.lang.Boolean, then an exception will throw.

        If the specified array-element inside 'ja' has been set to Json-Null, then Java-Null is returned.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JSON-BOOLEAN (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        JsonValue.getValueType(), JsonValue.ValueType.TRUE, JsonValue.ValueType.FALSE, JsonValue.TRUE, JsonValue.FALSE
        Code:
        Exact Method Body:
         // This will throw an IndexOutOfBoundsException if the index is out of bounds.
         JsonValue jv = ja.get(index);
        
         switch (jv.getValueType())
         {
             // This method 'getBOOLEAN' allows for null-returns.  If Json-Null, return Java-Null.
             case NULL: return null;
        
             // AGAIN: "Type-Mapping" or "Type-Translating" really isn't rocket-science
             case TRUE:  return true;
             case FALSE: return false;
        
             // The JsonValue at the specified array-index does not contain one of the two
             // Json-Boolean Types.  Throw an exception.
        
             default: throw new JsonTypeArrException(ja, index, TRUE, jv, Boolean.class);
         }
        
      • getBOOLEAN

        🡅  🡇    
        public static java.lang.Boolean getBOOLEAN​(JsonArray ja,
                                                   int index,
                                                   int FLAGS,
                                                   boolean defaultValue)
        Retrieve a JsonArray element, and transform it to a java.lang.Boolean. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JSON-BOOLEAN
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonArray index contained a number, and that number was successfully transformed to a java.lang.Boolean, then it is returned.

        If there were errors attempting to transform the array-element, but the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JSON-BOOLEAN, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JSON-BOOLEAN, and none of these Exception-Flags are set:
        See Also:
        JsonValue.getValueType(), JsonValue.ValueType.TRUE, JsonValue.ValueType.FALSE, JsonValue.TRUE, JsonValue.FALSE
        Code:
        Exact Method Body:
         // When TRUE, the index provided turned out to be outside of the bounds of the array.  The
         // IndexOutOfBounds "handler" (the method called here) will check the FLAGS, and:
         //
         //  1) return the defaultValue (if Requested by 'FLAGS' for IOOBEX)
         //  2) return null (if Requested by 'FLAGS' for IOOBEX)
         //  3) throw IndexOutOfBoundsException
        
         if (index >= ja.size()) return IOOBEX(ja, index, defaultValue, FLAGS);
        
         JsonValue jv = ja.get(index); // Throw an IndexOutOfBoundsException
        
         switch (jv.getValueType())
         {
             // When a 'NULL' (Json-Null) JsonValue is present, the JsonNullArrException 'handler'
             // will do one of the following:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JNAEX)
             //  2) return null (if Requested by 'FLAGS' for JNAEX)
             //  3) throw JsonNullArrException
        
             case NULL: return JNAEX(ja, index, defaultValue, FLAGS, TRUE, Boolean.class);
        
             // AGAIN: "Type-Mapping" or "Type-Translating" really isn't rocket-science
             case TRUE:  return true;
             case FALSE: return false;
        
             // The JsonValue at the specified array-index does not contain one of the two
             // Json-Boolean Types.  The "JsonTypeArrException Handler" will do one of these:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JTAEX)
             //  2) return null (if Requested by 'FLAGS' for JTAEX)
             //  3) throw JsonTypeArrException
        
             default: return JTAEX(ja, index, defaultValue, FLAGS, TRUE, jv, Boolean.class);
         }
        
      • parseBOOLEAN

        🡅  🡇    
        public static java.lang.Boolean parseBOOLEAN​
                    (JsonArray ja,
                     int index,
                     int FLAGS,
                     boolean defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Boolean> optionalParser)
        
        Retrieve a JsonArray element containing a JsonString, and transform it to a java.lang.Boolean, with either a user-provided parser, or the standard java boolean parser
        Parameters:
        ja - Any instance of JsonArray
        index - The array index containing the JsonString element to retrieve.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        optionalParser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Boolean.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Boolean.parseBoolean(String.trim()) is used.
        Returns:
        If the JsonArray index contained a JsonString, and that string was successfully parsed to a java.lang.Boolean, then it is returned.
        If there were errors attempting to transform the String array-element, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonStrParseArrException - If the JsonArray element located at 'index' throws an exception while attempting to parse the java.lang.String into a java.lang.Boolean, and none of these Exception-Flags are set:
        JsonNullArrException - If the JsonArray element located at 'index' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeArrException - If the JsonArray element located at 'index' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        Code:
        Exact Method Body:
         // When TRUE, the index provided turned out to be outside of the bounds of the array.  The
         // IndexOutOfBounds "handler" (the method called here) will check the FLAGS, and:
         //
         //  1) return the defaultValue (if Requested by 'FLAGS' for IOOBEX)
         //  2) return null (if Requested by 'FLAGS' for IOOBEX)
         //  3) throw IndexOutOfBoundsException
        
         if (index >= ja.size()) return IOOBEX(ja, index, defaultValue, FLAGS);
        
         JsonValue jv = ja.get(index);
        
         switch (jv.getValueType())
         {
             // When a 'NULL' (Json-Null) JsonValue is present, the JsonNullArrException 'handler'
             // will do one of the following:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JNAEX)
             //  2) return null (if Requested by 'FLAGS' for JNAEX)
             //  3) throw JsonNullArrException
        
             case NULL: return JNAEX(ja, index, defaultValue, FLAGS, STRING, Boolean.class);
        
             case STRING:
        
                 String s = ((JsonString) jv).getString();
        
                 // NOTE: This isn't actually an "Exception Case", and if the user hasn't made
                 //       a request, the empty-string is passed to whatever parser is configured
        
                 if (s.length() == 0)
                 {
                     if ((FLAGS & RETURN_NULL_ON_0LEN_STR) != 0)     return null;
                     if ((FLAGS & RETURN_DEFVAL_ON_0LEN_STR) != 0)   return defaultValue;
                     if ((FLAGS & RETURN_NULL_ON_ANY_ALL) != 0)      return null;
                     if ((FLAGS & RETURN_DEFVAL_ON_ANY_ALL) != 0)    return defaultValue;
                 }
        
                 try
                 {
                     return (optionalParser != null)
                         ? optionalParser.apply(s)
                         : Boolean.parseBoolean(s.trim());
                 }
        
                 // HANDLER STRIKES AGAIN! - but this time for "JsonStrParseArrException"
                 // RETURNS: null, or defaultValue, (otherwise throws JsonStrParseArrException)
        
                 catch (Exception e)
                     { return JSPAEX(e, ja, index, defaultValue, FLAGS, jv, Boolean.class); }
        
             // The JsonValue at the specified array-index does not contain an JsonString.
             // The "JsonTypeArrException Handler" will do one of these:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JTAEX)
             //  2) return null (if Requested by 'FLAGS' for JTAEX)
             //  3) throw JsonTypeArrException
        
             default: return JTAEX(ja, index, defaultValue, FLAGS, STRING, jv, Boolean.class);
         }
        
      • getBoolean

        🡅  🡇    
        public static boolean getBoolean​(JsonObject jo,
                                         java.lang.String propertyName)
        Extract a JsonObject property, and transform it to a 'boolean' primitive
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type boolean.
        Returns:
        An instance of Java-Type boolean, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JSON-BOOLEAN. Furthermore, that JSON-BOOLEAN must be assignable to Java Primitive Type boolean, or this method will throw an exception.
        Throws:
        JsonPropMissingException - This exception throws if the JsonObject (parameter 'jo') does not have any properties with the name 'propertyName'.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JSON-BOOLEAN (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullPrimitiveObjException - If 'propertyName' specifies a property inside 'jo' that has been assigned Json-Null, then this exception will throw. (Unlike Json, in Java a Primitive boolean will not accept 'null' as a value).
        See Also:
        getBOOLEAN(JsonObject, String, boolean)
        Code:
        Exact Method Body:
         // Since 'false' is passed, a null return-value will mean that the property was actually
         // set to null in the JsonObject itself.  (It *IS NOT* missing, it is present, but rather
         // declared null)
        
         Boolean ret = getBOOLEAN(jo, propertyName, false);
        
         if (ret == null) throw new JsonNullPrimitiveObjException
             (jo, propertyName, TRUE, boolean.class);
        
         // NOTE: Java's Type-Stuff can automatically convert Boolean -> boolean
         else return ret;
        
      • getBOOLEAN

        🡅  🡇    
        public static java.lang.Boolean getBOOLEAN​(JsonObject jo,
                                                   java.lang.String propertyName,
                                                   boolean isOptional)
        Extract a JsonObject property, and transform it to a java.lang.Boolean. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Boolean.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        Returns:
        An instance of Java-Type java.lang.Boolean, if and only if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JSON-BOOLEAN

        If the specified property has been set to 'null' (Json-Null) in the passed JsonObject, then Java-Null is returned. Java-Null is also returned if 'propertyName' is not listed / unavailable in 'jo' and TRUE has been passed to 'isOptional'.

        Other cases shall generate an exception throw.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JSON-BOOLEAN (but rather, some other non-null Json-Type), then this exception throws.
        See Also:
        JsonValue.getValueType(), JsonValue.ValueType.TRUE, JsonValue.ValueType.FALSE, JsonValue.TRUE, JsonValue.FALSE
        Code:
        Exact Method Body:
         if (! jo.containsKey(propertyName))
         {
             if (isOptional) return null;
        
             throw new JsonPropMissingException(jo, propertyName, TRUE, Boolean.class);
         }
        
         JsonValue jv = jo.get(propertyName);
        
         switch (jv.getValueType())
         {
             // This method 'getBOOLEAN' allows for null-returns.  If Json-Null, return Java-Null.
             case NULL: return null;
        
             // AGAIN: "Type-Mapping" or "Type-Translating" really isn't rocket-science
             case TRUE:  return true;
             case FALSE: return false;
        
             // The JsonValue at the specified array-index does not contain one of the two
             // Json-Boolean Types.  Throw an exception.
        
             default: throw new JsonTypeObjException
                 (jo, propertyName, TRUE, jv, Boolean.class);
         }
        
      • getBOOLEAN

        🡅  🡇    
        public static java.lang.Boolean getBOOLEAN​(JsonObject jo,
                                                   java.lang.String propertyName,
                                                   int FLAGS,
                                                   boolean defaultValue)
        Retrieve a JsonObject property, and transform it to a java.lang.Boolean. If Json-Null is found - then Java-Null is returned.

        NOTE: This method facilitates translating a Json-Null into a Java-Null since a Java Boxed-Type number is returned from this method, rather than a Java Primitive
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Boolean.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        Returns:
        If the JsonObject property contained a number, and that number was successfully transformed to a java.lang.Boolean, then it is returned.

        If there were errors attempting to transform the object-property, and the user-provided flags have specified that the defaultValue be returned, then that is returned. Null is returned if the flags have specified a null-return on error.

        If flags has been passed a '0', and an error-case has arisen, then, instead, the relevant exception will throw.
        Throws:
        JsonPropMissingException - If 'jo' does not have a property with the name 'propertyName' and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JSON-BOOLEAN, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JSON-BOOLEAN, and none of these Exception-Flags are set:
        See Also:
        JsonValue.getValueType(), JsonValue.ValueType.TRUE, JsonValue.ValueType.FALSE, JsonValue.TRUE, JsonValue.FALSE
        Code:
        Exact Method Body:
         JsonValue jv = jo.get(propertyName);
        
         // When TRUE, the user-specified 'property' (named by 'propertyName') isn't actually one
         // of the listed properties inside the JsonObject.  The JsonPropMissingException "handler"
         // (the method called here) will check the FLAGS, and:
         //
         //  1) return the defaultValue (if Requested by 'FLAGS' for JPMEX)
         //  2) return null (if Requested by 'FLAGS' for JPMEX)
         //  3) throw JsonPropMissingException
        
         if (jv == null) return JPMEX(jo, propertyName, defaultValue, FLAGS, TRUE, Boolean.class);
        
         switch (jv.getValueType())
         {
             // When a 'NULL' (Json-Null) JsonValue is present, the JsonNullObjException 'handler'
             // will do one of the following:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JNOEX)
             //  2) return null (if Requested by 'FLAGS' for JNOEX)
             //  3) throw JsonNullArrException
        
             case NULL: return JNOEX(jo, propertyName, defaultValue, FLAGS, TRUE, Boolean.class);
        
             // AGAIN: "Type-Mapping" or "Type-Translating" really isn't rocket-science
             case TRUE:  return true;
             case FALSE: return false;
        
             // The property contains a JsonValue that is not one of the two
             // Json-Boolean Types.  Throw an exception.
        
             // The JsonValue of 'propertyName' does not contain an JsonString.
             // The "JsonTypeObjException Handler" will do one of these:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JTOEX)
             //  2) return null (if Requested by 'FLAGS' for JTOEX)
             //  3) throw JsonTypeObjException
        
             default: return JTOEX(jo, propertyName, defaultValue, FLAGS, TRUE, jv, Boolean.class);
         }
        
      • parseBOOLEAN

        🡅  🡇    
        public static java.lang.Boolean parseBOOLEAN​
                    (JsonObject jo,
                     java.lang.String propertyName,
                     int FLAGS,
                     boolean defaultValue,
                     java.util.function.Function<java.lang.String,​java.lang.Boolean> parser)
        
        Retrieve a JsonObject property containing a JsonString, and transform it to a java.lang.Boolean, with either a user-provided parser, or the standard java boolean parser
        Parameters:
        jo - Any instance of JsonObject
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.Float.
        FLAGS - The return-value / exception-throw flag constants defined in JFlag
        defaultValue - This is the 'Default Value' returned by this method, if there are any exception or problems converting or extracting the specified number.

        The default value is only returned by this method if the appropriate JSON Exception Flag has been passed to the 'FLAGS' parameter! Specifically, if 'FLAGS' were passed '0', then this parameter is fully-irrelevant and ignored. The exception flags are listed in inner-class JFlags

        AGAIN: If an exception-case is encountered, but the exception-flag for that exception has not been set, then this default-value won't be returned, and that exception will throw instead.
        parser - Any function-pointer to a function that will transform / convert a java.lang.String into a java.lang.Float.

        NOTE: This parameter may be null, and if it is, the standard Java invocation of Float.parseFloat(String.trim()) is used.
        Returns:
        If the JsonObject property contained a JsonString, and that string was successfully parsed to a java.lang.Float, then it is returned.
        If there were errors attempting to transform the String object-property, and the user-provided flags specified that defaultValue be returned, then that is returned. Null is returned if the flags specified it on error.

        If flags has been passed a '0', and an error-case has arisen, then the relevant exception will throw, instead.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of input array 'ja' and none of these Exception-Flags are set:
        JsonStrParseObjException - If the JsonObject property specified by 'propertyName' throws an exception while attempting to parse the java.lang.String into a java.lang.Float, and none of these Exception-Flags are set:
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains Json-Null, rather than a JsonString, and none of these Exception-Flags are set:
        JsonTypeObjException - If the JsonObject property specified by 'propertyName' contains a some other Json-Type rather than JsonString, and none of these Exception-Flags are set:
        Code:
        Exact Method Body:
         JsonValue jv = jo.get(propertyName);
        
         // When TRUE, the user-specified 'property' (named by 'propertyName') isn't actually one
         // of the listed properties inside the JsonObject.  The JsonPropMissingException "handler"
         // (the method called here) will check the FLAGS, and:
         //
         //  1) return the defaultValue (if Requested by 'FLAGS' for JPMEX)
         //  2) return null (if Requested by 'FLAGS' for JPMEX)
         //  3) throw JsonPropMissingException
        
         if (jv == null) return JPMEX(jo, propertyName, defaultValue, FLAGS, STRING, Boolean.class);
        
         switch (jv.getValueType())
         {
             // When a 'NULL' (Json-Null) JsonValue is present, the JsonNullObjException 'handler'
             // will do one of the following:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JNOEX)
             //  2) return null (if Requested by 'FLAGS' for JNOEX)
             //  3) throw JsonNullArrException
        
             case NULL: return JNOEX(jo, propertyName, defaultValue, FLAGS, STRING, Boolean.class);
        
             case STRING:
        
                 String s = ((JsonString) jv).getString();
        
                 // NOTE: This isn't actually an "Exception Case", and if the user hasn't made
                 //       a request, the empty-string is passed to whatever parser is configured
        
                 if (s.length() == 0)
                 {
                     if ((FLAGS & RETURN_NULL_ON_0LEN_STR) != 0)     return null;
                     if ((FLAGS & RETURN_DEFVAL_ON_0LEN_STR) != 0)   return defaultValue;
                     if ((FLAGS & RETURN_NULL_ON_ANY_ALL) != 0)      return null;
                     if ((FLAGS & RETURN_DEFVAL_ON_ANY_ALL) != 0)    return defaultValue;
                 }
        
                 try
                     { return (parser != null) ? parser.apply(s) : Boolean.parseBoolean(s.trim()); }
        
                 // HANDLER STRIKES AGAIN! - but this time for "JsonStrParseObjException"
                 // RETURNS: null, or defaultValue, (otherwise throws JsonStrParseObjException)
        
                 catch (Exception e)
                     { return JSPOEX(e, jo, propertyName, defaultValue, FLAGS, jv, Boolean.class); }
        
             // The JsonValue of 'propertyName' does not contain an JsonString.
             // The "JsonTypeObjException Handler" will do one of these:
             //
             //  1) return the defaultValue (if Requested by 'FLAGS' for JTOEX)
             //  2) return null (if Requested by 'FLAGS' for JTOEX)
             //  3) throw JsonTypeObjException
        
             default: return JTOEX(jo, propertyName, defaultValue, FLAGS, STRING, jv, Boolean.class);
         }
        
      • getString

        🡅  🡇    
        public static java.lang.String getString​(JsonArray ja,
                                                 int index,
                                                 boolean throwOnNull)
        Retrieve a JsonArray element, and transform it to a java.lang.String.
        Parameters:
        ja - Any instance of JsonArray
        index - A valid index into array parameter 'ja'. In Json (and unlike Java), array element types are not actually checked for consistency - meaning an array may hold many different types! This array-index must contain a JsonString
        throwOnNull - When TRUE is passed to this parameter, if the JsonArray element located at 'index' contains Json-Null, then this method will throw a JsonNullArrException. When this parameter is FALSE, if the specified array element contains Json-Null, then Java-Null is returned.
        Returns:
        An instance of Java-Type java.lang.String, if the 'ja' array element located at 'index' uses the appropriate Json-Type - JsonString.

        If the specified array element contains Json-Null, and 'throwOnNull' has been passed FALSE, then Java-Null is returned. If the element is null, and 'throwOnNull' is TRUE, then a JsonNullArrException throws.
        Throws:
        java.lang.IndexOutOfBoundsException - If 'index' is out of the bounds of 'ja'
        JsonTypeArrException - If the array-element (specified by 'index') does not actually contain a JsonString (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullArrException - If the JsonArray element specified by 'index' contains a Json-Null, and TRUE has been passed to 'throwOnNull'
        See Also:
        JsonValue.getValueType(), JsonValue.ValueType.STRING
        Code:
        Exact Method Body:
         // This will throw an IndexOutOfBoundsException if the index is out of bounds.
         JsonValue jv = ja.get(index);
        
         switch (jv.getValueType())
         {
             case NULL:
        
                 // This is simple-stuff (not rocket-science).  "Type Mapping" Code has to worry
                 // about what the meaning of "null" should be.
        
                 if (throwOnNull) throw new JsonNullArrException(ja, index, STRING, String.class);
                 else return null;
        
             case STRING: return ((JsonString) jv).getString();
        
             // The JsonValue at the specified array-index does not contain a JsonString.
             default: throw new JsonTypeArrException(ja, index, STRING, jv, String.class);
         }
        
      • getString

        🡅    
        public static java.lang.String getString​(JsonObject jo,
                                                 java.lang.String propertyName,
                                                 boolean isOptional,
                                                 boolean throwOnNull)
        Extract a JsonObject property, and transform it to a java.lang.String.
        Parameters:
        jo - Any instance of JsonObject.
        propertyName - The name of the JSON property that should be contained within 'jo'. This property will be retrieved and subsequently transformed / converted to Java-Type java.lang.String.
        isOptional - When TRUE is passed, if 'propertyName' is not actually listed in 'jo' this method shall return Java-Null gracefully. When FALSE is passed, if 'jo' does not have the specified property, a JsonPropMissingException will throw.

        If 'jo' actually has a property named 'propertyName', then the value passed to this parameter is fully irrelevant.
        throwOnNull - When TRUE is passed to this parameter, if the JsonObject property named 'propertyName' evaluates to Json-Null, then this method will throw a JsonNullObjException. When this parameter is FALSE, if the specified property contains Json-Null, then Java-Null is returned.
        Returns:
        An instance of Java-Type java.lang.String', if the 'propertyName' is available inside 'jo', and that property uses the appropriate Json-Type - JsonString.

        If the specified property contains Json-Null, and 'throwOnNull' has been passed FALSE, then Java-Null is returned. If the property is null, and 'throwOnNull' is TRUE, then a JsonNullObjException throws.

        If the specified property is simply missing, Java-Null is returned, unless 'isOptional' has been passed FALSE - in which case a JsonPropMissingException shall be thrown.
        Throws:
        JsonPropMissingException - This exception shall throw if the specified property is missing from the 'JsonObject' (parameter 'jo'). This exception throw can be avoided if 'TRUE' is passed to parameter 'isOptional'.
        JsonTypeObjException - If the property (specified by 'propertyName') is extracted, but that property does not actually contain a JsonString (but rather, some other non-null Json-Type), then this exception throws.
        JsonNullObjException - If the JsonObject property specified by 'propertyName' contains a Json-Null, and TRUE has been passed to 'throwOnNull'
        See Also:
        JsonValue.getValueType(), JsonValue.ValueType.STRING
        Code:
        Exact Method Body:
         if (! jo.containsKey(propertyName))
         {
             if (isOptional) return null;
        
             throw new JsonPropMissingException(jo, propertyName, STRING, String.class);
         }
        
         JsonValue jv = jo.get(propertyName);
        
         switch (jv.getValueType())
         {
             case NULL:
        
                 // This is simple-stuff (not rocket-science).  "Type Mapping" Code has to worry
                 // about what the meaning of "null" should be.
        
                 if (throwOnNull) throw new JsonNullObjException
                     (jo, propertyName, STRING, String.class);
        
                 else return null;
        
             case STRING: return ((JsonString) jv).getString();
        
             // The JsonObject propertydoes not contain a JsonString.
             default: throw new JsonTypeObjException(jo, propertyName, STRING, jv, String.class);
         }