001package Torello.Java.JSON;
002
003import javax.json.*;
004
005/**
006 * Used to indicate that one of the properties within a {@link JsonObject} contained a different
007 * type than was requested / expected by the reader.  There are several convenience field-constants
008 * provided by the parent-class of this exception, and an additional field provided here too.  In
009 * order to hopefully continue to make easy-code actually look easy, the following keywords used in
010 * this exception's name are broken down below.
011 * 
012 * <EMBED CLASS=globalDefs DATA-STRUCT=JsonObject DATA-TYPE=Object DATA-TYPE_ABBREV=Obj>
013 * <EMBED CLASS='external-html' DATA-FILE-ID=JE_FIELD_OBJ>
014 * <EMBED CLASS='external-html' DATA-FILE-ID=JE_MSG>
015 * <EMBED CLASS='external-html' DATA-FILE-ID=JE_MSG_JTOEX>
016 */
017@Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="JE_T_UL")
018@Torello.JavaDoc.CSSLinks(FileNames="JSONExceptions.css")
019public class JsonTypeObjException extends JsonBindingObjException
020{
021    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX>  */
022    public static final long serialVersionUID = 1;
023
024    /**
025     * Constructs a {@code JsonTypeObjException} with no specified detail messsage,
026     * and the user-provided convenience-field values.
027     * 
028     * @param errorSourceJsonObject <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_ESJO>
029     * @param propertyName          <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_PN>
030     * @param expectedJsonType      <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_EJT>
031     * @param valueRetrieved        <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_VR>
032     * @param methodReturnJavaType  <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_MRJT>
033     */
034    public JsonTypeObjException(
035            JsonObject          errorSourceJsonObject,
036            String              propertyName,
037            JsonValue.ValueType expectedJsonType,
038            JsonValue           valueRetrieved,
039            Class<?>            methodReturnJavaType
040        )
041    {
042        super(
043            errorSourceJsonObject, propertyName, expectedJsonType, valueRetrieved,
044            methodReturnJavaType, "A JsonObject property contained an unexpected Json-Type"
045        );
046    }
047
048    /**
049     * Constructs a {@code JsonTypeObjException} with the specified detail message, and
050     * user-provided convenience-field values.
051     * 
052     * @param message the detail message.
053     * @param errorSourceJsonObject <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_ESJO>
054     * @param propertyName          <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_PN>
055     * @param expectedJsonType      <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_EJT>
056     * @param valueRetrieved        <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_VR>
057     * @param methodReturnJavaType  <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_MRJT>
058     */
059    public JsonTypeObjException(
060            String              message,
061            JsonObject          errorSourceJsonObject,
062            String              propertyName,
063            JsonValue.ValueType expectedJsonType,
064            JsonValue           valueRetrieved,
065            Class<?>            methodReturnJavaType
066        )
067    {
068        super(
069            message, errorSourceJsonObject, propertyName, expectedJsonType, valueRetrieved,
070            methodReturnJavaType
071        );
072    }
073}