Class JsonBindingArrException

    • 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;
        
      • index

        🡅  🡇    
        public final int index
        This field is provided to the user as a matter of convenience. All instantiations of this Exception are should guarantee to enforce and ensure that when an instance of this exception is thrown, the convenience field is not set null. If this package is extended, it is up to the programmer/user to make sure not to leave this field null when using one of these constructors.

        IMPORTANT: All this is really trying to explain is that, when debugging your code, if in the analysis of a particular Exception, that analysis causes another exception throw (NullPointerException) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache.

        This is the array index into the source JsonArray which contained the element (or lack-there-of) that has caused this exception.
        Code:
        Exact Field Declaration Expression:
         public final int index;
        
    • Constructor Detail

      • JsonBindingArrException

        🡅  🡇    
        public JsonBindingArrException​(JsonArray errorSourceJsonArray,
                                       int index,
                                       JsonValue.ValueType expectedJsonType,
                                       JsonValue valueRetrieved,
                                       java.lang.Class<?> methodReturnJavaType,
                                       java.lang.String endingNote)
        Constructs a JsonBindingArrException with no specified detail messsage, and the user-provided convenience-field values.
        Parameters:
        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.
        endingNote - The distinct message for the exception sub-class.
      • JsonBindingArrException

        🡅  🡇    
        public JsonBindingArrException​(java.lang.String message,
                                       JsonArray errorSourceJsonArray,
                                       int index,
                                       JsonValue.ValueType expectedJsonType,
                                       JsonValue valueRetrieved,
                                       java.lang.Class<?> methodReturnJavaType)
        Constructs a JsonBindingArrException with the specified detail message, and user-provided convenience-field values.
        Parameters:
        message - the detail message.
        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.
      • JsonBindingArrException

        🡅  🡇    
        public JsonBindingArrException​(java.lang.String message,
                                       java.lang.Throwable cause,
                                       JsonArray errorSourceJsonArray,
                                       int index,
                                       JsonValue.ValueType expectedJsonType,
                                       JsonValue valueRetrieved,
                                       java.lang.Class<?> methodReturnJavaType)
        Constructs a new JsonBindingArrException with the specified detail message and cause

        NOTE: The detail message associated with cause is not automatically incorporated in this exception's detail message.
        Parameters:
        message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method).
        cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
        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.
      • JsonBindingArrException

        🡅  🡇    
        public JsonBindingArrException​(java.lang.Throwable cause,
                                       JsonArray errorSourceJsonArray,
                                       int index,
                                       JsonValue.ValueType expectedJsonType,
                                       JsonValue valueRetrieved,
                                       java.lang.Class<?> methodReturnJavaType,
                                       java.lang.String endingNote)
        Constructs a new JsonBindingArrException with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for exceptions that are little more than wrappers for other throwables.
        Parameters:
        cause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
        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.
        endingNote - The distinct message for the exception sub-class.
    • Method Detail

      • BASE_MESSAGE_ARR

        🡅    
        protected static java.lang.String BASE_MESSAGE_ARR​
                    (JsonArray errorSourceJsonArray,
                     int index,
                     JsonValue.ValueType expectedJsonType,
                     JsonValue valueRetrieved,
                     java.lang.Class<?> methodReturnJavaType,
                     java.lang.String endingNote,
                     java.lang.Throwable... causes)
        
        A simple helper method for printing a consistent error messge using the input-data convenience fields of JsonArray's.
        Parameters:
        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.
        endingNote - The distinct message for the exception sub-class.
        causes - Optional Parameter. At most 1 cause is printed.
        Returns:
        The error message String.
        Code:
        Exact Method Body:
         return 
             ((endingNote != null) ? endingNote : "") +"\n" +
             CAUSE_MESSAGE(causes) +
             "\tFound In JsonArray:       " + ABBREV_STRUCT(errorSourceJsonArray) + "\n" +
             "\tAt Index:                 " + index + "\n" +
             "\tExpected Json-Type:       " + JT_STR(expectedJsonType) + "\n" +
             "\tContained JsonValue:      " + ABBREV_VAL(valueRetrieved) + "\n" +
             "\tHaving Actual Json-Type:  " + JT_STR((valueRetrieved != null)
                     ? valueRetrieved.getValueType()
                     : null
                 ) + "\n" +
             "\tConverting To Java-Type:  " + ((methodReturnJavaType != null)
                     ? methodReturnJavaType.getCanonicalName()
                     : "Java-Type Unknown"
                 );