Package Torello.JSON
Class JsonBuildPOJOArrException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- javax.json.JsonException
-
- Torello.JSON.JsonBindingException
-
- Torello.JSON.JsonBindingArrException
-
- Torello.JSON.JsonBuildPOJOArrException
-
- All Implemented Interfaces:
java.io.Serializable
public class JsonBuildPOJOArrException extends JsonBindingArrException
JsonBuildPOJOArrException 🠞Json- This exception is thrown by the Json Reader Classes
BuildPOJO- A User-Provided builder function or a User-Provided Class-Constructor has actually thrown an exception while trying to build or generate a Java POJO using aJsonObjectas input to its constructor or builder-lambda.
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 aJsonObjectproperty and aJsonArrayindex are somewhat different - there are two different exceptions for them! (An Exception forObject'sand an exception forArray's).
This class reports errors & exceptions that occur when extracting aJsonObjectfrom aJsonArray, but end-up causing the ensuing user-provided constructor or builder invocation to throw.
Exception- This class inherits classException
Used to indicate that one of the elements within aJsonArraywas a parsed or validJsonObject, but either a User-Provided Builder-Function, or aJsonObject-Constructor, has failed to build a POJO instance (using the extractedJsonObject) and has thrown instead.
The following'final'Convenience Fields are exported by this Exception Class:Inherited Field Field Type Inherited From indexintJsonBindingArrExceptionerrorSourceJsonStructJsonStructureJsonBindingExceptionexpectedJsonTypeJsonValue.ValueTypeJsonBindingExceptionmethodReturnJavaTypejava.lang.ClassJsonBindingExceptionvalueRetrievedJsonValueJsonBindingException
The main benefit of this complicated exception-class inheritance tree are the exception messages generated by this class. If any sub-class ofJsonBindingExceptionis 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.JSON.JsonBuildPOJO --- Exception: ... [followed by stack-trace]- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/JSON/JsonBuildPOJOArrException.java
- Open New Browser-Tab: Torello/JSON/JsonBuildPOJOArrException.java
File Size: 3,752 Bytes Line Count: 87 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field static longserialVersionUID-
Fields inherited from class Torello.JSON.JsonBindingArrException
index
-
Fields inherited from class Torello.JSON.JsonBindingException
errorSourceJsonStruct, expectedJsonType, methodReturnJavaType, valueRetrieved
-
-
Constructor Summary
Constructors Constructor JsonBuildPOJOArrException(String message, Throwable cause, JsonArray errorSourceJsonArray, int index, JsonObject joRetrieved, Class<?> methodReturnJavaType)JsonBuildPOJOArrException(Throwable cause, JsonArray errorSourceJsonArray, int index, JsonObject joRetrieved, Class<?> methodReturnJavaType)
-
Method Summary
-
Methods inherited from class Torello.JSON.JsonBindingArrException
BASE_MESSAGE_ARR
-
Methods inherited from class Torello.JSON.JsonBindingException
BASE_MESSAGE
-
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable. Using theSerializableImplementation 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'sjava.lang.Exceptionandjava.lang.Errorclasses implement theSerializable 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
-
JsonBuildPOJOArrException
public JsonBuildPOJOArrException(java.lang.Throwable cause, JsonArray errorSourceJsonArray, int index, JsonObject joRetrieved, java.lang.Class<?> methodReturnJavaType)
Constructs aJsonBuildPOJOArrExceptionwith no specified detail messsage, and the user-provided convenience-field values.- Parameters:
cause- The exception thrown by the user-provided constructor or builder functionerrorSourceJsonArray- TheJsonArrayfrom which the element is being retrieved / extracted.index- This is theJsonArrayindex from which the element is being retrieved / extracted.joRetrieved- A valid instance ofJsonObjectwhich has been properly extracted from either aJsonArrayor aJsonObject. This must be the object which has caused the user-provided constructor or builder-lambda to throw.methodReturnJavaType- ClassReadJSONwill always provide the ultimate Java-Type that is to be returned by the method where this exception is being thrown.
-
JsonBuildPOJOArrException
public JsonBuildPOJOArrException(java.lang.String message, java.lang.Throwable cause, JsonArray errorSourceJsonArray, int index, JsonObject joRetrieved, java.lang.Class<?> methodReturnJavaType)
Constructs aJsonBuildPOJOArrExceptionwith the specified detail message, and user-provided convenience-field values.- Parameters:
message- the detail message.cause- The exception thrown by the user-provided constructor or builder functionerrorSourceJsonArray- TheJsonArrayfrom which the element is being retrieved / extracted.index- This is theJsonArrayindex from which the element is being retrieved / extracted.joRetrieved- A valid instance ofJsonObjectwhich has been properly extracted from either aJsonArrayor aJsonObject. This must be the object which has caused the user-provided constructor or builder-lambda to throw.methodReturnJavaType- ClassReadJSONwill always provide the ultimate Java-Type that is to be returned by the method where this exception is being thrown.
-
-