Package Torello.JSON
Class JsonArithmeticObjException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- javax.json.JsonException
-
- Torello.JSON.JsonBindingException
-
- Torello.JSON.JsonBindingObjException
-
- Torello.JSON.JsonArithmeticObjException
-
- All Implemented Interfaces:
java.io.Serializable
public class JsonArithmeticObjException extends JsonBindingObjException
JsonArithmeticObjException 🠞Json- This exception is thrown by the Json Reader Classes
Arithmetic- AJsonObjector aJsonArraycontained 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) ajava.lang.ArithmeticExceptioninstead
Obj- 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 arithmetic-errors that occur when retrieving data fromJsonObject's
Exception- This class inherits classException
Used to indicate that one of the properties within aJsonObjectcaused a JavaArithmeticExceptionto throw when attempting to bind the property to a Java Number Type.
The following'final'Convenience Fields are exported by this Exception Class:Inherited Field Field Type Inherited From propertyNamejava.lang.StringJsonBindingObjExceptionerrorSourceJsonStructJsonStructureJsonBindingExceptionexpectedJsonTypeJsonValue.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.JsonArithmeticObjException: An ArithmeticException has occured durng the Json -> Java Type Conversion Cause-Exception Class: java.lang.ArithmeticException Cause-Exception Message: Rounding necessary Found In JsonObject: {"yearPurchased":1999.5} Property-Name: yearPurchased Expected Json-Type: JsonValue.ValueType.NUMBER Contained JsonValue: 1999.5 Having Actual Json-Type: JsonValue.ValueType.NUMBER Converting To Java-Type: int ... [followed by stack-trace]- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/JSON/JsonArithmeticObjException.java
- Open New Browser-Tab: Torello/JSON/JsonArithmeticObjException.java
File Size: 3,473 Bytes Line Count: 76 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field static longserialVersionUID-
Fields inherited from class Torello.JSON.JsonBindingObjException
propertyName
-
Fields inherited from class Torello.JSON.JsonBindingException
errorSourceJsonStruct, expectedJsonType, methodReturnJavaType, valueRetrieved
-
-
Constructor Summary
Constructors Constructor JsonArithmeticObjException(ArithmeticException cause, JsonObject errorSourceJsonObject, String propertyName, JsonValue.ValueType expectedJsonType, JsonValue valueRetrieved, Class<?> methodReturnJavaType)JsonArithmeticObjException(String message, ArithmeticException cause, JsonObject errorSourceJsonObject, String propertyName, JsonValue.ValueType expectedJsonType, JsonValue valueRetrieved, Class<?> methodReturnJavaType)
-
Method Summary
-
Methods inherited from class Torello.JSON.JsonBindingObjException
BASE_MESSAGE_OBJ
-
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
-
JsonArithmeticObjException
public JsonArithmeticObjException(java.lang.ArithmeticException cause, JsonObject errorSourceJsonObject, java.lang.String propertyName, JsonValue.ValueType expectedJsonType, JsonValue valueRetrieved, java.lang.Class<?> methodReturnJavaType)
Constructs aJsonArithmeticObjExceptionwith no specified detail messsage, and the user-provided convenience-field values.- Parameters:
cause- TheArithmeticExceptionwhich caused this exception to throwerrorSourceJsonObject- TheJsonObjectfrom which the property is being retrieved / extracted.propertyName- This is the property-name into theJsonObjectfrom which the property is being retrieved / extracted.expectedJsonType- This is the Json-Type that was expected to be retrieved fromJsonObject.valueRetrieved- This is theJsonValuethat was extracted from theJsonObjectwhich 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 beJsonValue.NULLmethodReturnJavaType- ClassReadJSONwill always provide the ultimate Java-Type that is to be returned by the method where this exception is being thrown.
-
JsonArithmeticObjException
public JsonArithmeticObjException(java.lang.String message, java.lang.ArithmeticException cause, JsonObject errorSourceJsonObject, java.lang.String propertyName, JsonValue.ValueType expectedJsonType, JsonValue valueRetrieved, java.lang.Class<?> methodReturnJavaType)
Constructs aJsonArithmeticObjExceptionwith the specified detail message, and user-provided convenience-field values.- Parameters:
message- the detail message.cause- TheArithmeticExceptionwhich caused this exception to throwerrorSourceJsonObject- TheJsonObjectfrom which the property is being retrieved / extracted.propertyName- This is the property-name into theJsonObjectfrom which the property is being retrieved / extracted.expectedJsonType- This is the Json-Type that was expected to be retrieved fromJsonObject.valueRetrieved- This is theJsonValuethat was extracted from theJsonObjectwhich 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 beJsonValue.NULLmethodReturnJavaType- ClassReadJSONwill always provide the ultimate Java-Type that is to be returned by the method where this exception is being thrown.
-
-