Class JsonArithmeticArrException

  • All Implemented Interfaces:
    java.io.Serializable

    public class JsonArithmeticArrException
    extends JsonBindingArrException
    JsonArithmeticArrException 🠞
    • Json - This exception is thrown by the Json Reader Classes

    • Arithmetic - A JsonObject or a JsonArray contained an entry that was supposed to be converted into a numeric-type, but threw (or was about to throw, when the error was first identified) a java.lang.ArithmeticException instead

    • Arr - Since these exceptions contain 'convenience fields' which provide some simple data about the Json that caused the exception throw, and since the 'relevant information' about a JsonObject property and a JsonArray index are somewhat different - there are two different exceptions for them! (An Exception for Object's and an exception for Array's).

      This class reports arithmetic-errors that occur when retrieving data from JsonArray's

    • Exception - This class inherits class Exception
    Used to indicate that one of the elements within a JsonArray caused a Java ArithmeticException to throw when attempting to bind the element to a Java Number Type.

    The following 'final' Convenience Fields are exported by this Exception Class:
    Inherited Field Field Type Inherited From
    index int JsonBindingArrException
    errorSourceJsonStruct JsonStructure JsonBindingException
    expectedJsonType JsonValue.ValueType JsonBindingException
    methodReturnJavaType java.lang.Class JsonBindingException
    valueRetrieved JsonValue JsonBindingException

    The main benefit of this complicated exception-class inheritance tree are the exception messages generated by this class. If any sub-class of JsonBindingException is thrown, it is guaranteed to produce as much detail as possible about which Json-Element has generated the error. Below is an example of what this class exception messages look like:

    Terminal Output:
    Exception in thread "main" Torello.Java.Additional.JsonArithmeticArrException: An ArithmeticException has occured durng the Json -> Java Type Conversion Cause-Exception Class: java.lang.ArithmeticException Cause-Exception Message: Rounding necessary Found In JsonArray: [0,2.781828,3.14159] At Index: 2 Expected Json-Type: JsonValue.ValueType.NUMBER Contained JsonValue: 3.14159 Having Actual Json-Type: JsonValue.ValueType.NUMBER Converting To Java-Type: int ... [followed by stack-trace]
    See Also:
    Serialized Form


    • Field Detail

      • serialVersionUID

        🡇     🗕  🗗  🗖
        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Note that Java's java.lang.Exception and java.lang.Error classes implement the Serializable interface, and a warning-free build expects this field be defined here.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
        
    • Constructor Detail

      • JsonArithmeticArrException

        🡅  🡇     🗕  🗗  🗖
        public JsonArithmeticArrException​(java.lang.ArithmeticException cause,
                                          JsonArray errorSourceJsonArray,
                                          int index,
                                          JsonValue.ValueType expectedJsonType,
                                          JsonValue valueRetrieved,
                                          java.lang.Class<?> methodReturnJavaType)
        Constructs a JsonArithmeticArrException with no specified detail messsage, and the user-provided convenience-field values.
        Parameters:
        cause - The ArithmeticException which caused this exception to throw
        errorSourceJsonArray - The JsonArray from which the element is being retrieved / extracted.
        index - This is the JsonArray index from which the element is being retrieved / extracted.
        expectedJsonType - This is the Json-Type that was expected to be retrieved from JsonArray.
        valueRetrieved - This is the JsonValue that was extracted from the JsonArray which caused an exception. Note that if the entity did not exist, then this parameter will be Java-Null. If Json-Null was found, then this parameter should be JsonValue.NULL
        methodReturnJavaType - Class ReadJSON will always provide the ultimate Java-Type that is to be returned by the method where this exception is being thrown.
      • JsonArithmeticArrException

        🡅     🗕  🗗  🗖
        public JsonArithmeticArrException​(java.lang.String message,
                                          java.lang.ArithmeticException cause,
                                          JsonArray errorSourceJsonArray,
                                          int index,
                                          JsonValue.ValueType expectedJsonType,
                                          JsonValue valueRetrieved,
                                          java.lang.Class<?> methodReturnJavaType)
        Constructs a JsonArithmeticArrException with the specified detail message, and user-provided convenience-field values.
        Parameters:
        message - the detail message.
        cause - The ArithmeticException which caused this exception to throw
        errorSourceJsonArray - The JsonArray from which the element is being retrieved / extracted.
        index - This is the JsonArray index from which the element is being retrieved / extracted.
        expectedJsonType - This is the Json-Type that was expected to be retrieved from JsonArray.
        valueRetrieved - This is the JsonValue that was extracted from the JsonArray which caused an exception. Note that if the entity did not exist, then this parameter will be Java-Null. If Json-Null was found, then this parameter should be JsonValue.NULL
        methodReturnJavaType - Class ReadJSON will always provide the ultimate Java-Type that is to be returned by the method where this exception is being thrown.