001package Torello.Java.JSON;
002
003import javax.json.*;
004
005/**
006 * Used to indicate that one of the properties within a {@link JsonObject} contained null, where a
007 * valid primitive-value was expected.  There are several convenience field-constants provided by
008 * the parent-class of this exception, and an additional field provided here too.
009 * 
010 * <EMBED CLASS=globalDefs DATA-STRUCT=JsonObject DATA-TYPE=Object DATA-TYPE_ABBREV=Obj>
011 * <EMBED CLASS='external-html' DATA-FILE-ID=JE_FIELD_OBJ>
012 * <EMBED CLASS='external-html' DATA-FILE-ID=JE_MSG>
013 * <EMBED CLASS='external-html' DATA-FILE-ID=JE_MSG_JNPOEX>
014 */
015@Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="JE_NP_UL")
016@Torello.JavaDoc.CSSLinks(FileNames="JSONExceptions.css")
017public class JsonNullPrimitiveObjException extends JsonBindingObjException
018{
019    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX>  */
020    public static final long serialVersionUID = 1;
021
022    /**
023     * Constructs a {@code JsonNullPrimitiveObjException} with no specified detail messsage,
024     * and the user-provided convenience-field values.
025     * 
026     * @param errorSourceJsonObject <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_ESJO>
027     * @param propertyName          <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_PN>
028     * @param expectedJsonType      <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_EJT>
029     * @param methodReturnJavaType  <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_MRJT>
030     */
031    public JsonNullPrimitiveObjException(
032            JsonObject          errorSourceJsonObject,
033            String              propertyName,
034            JsonValue.ValueType expectedJsonType,
035            Class<?>            methodReturnJavaType
036        )
037    {
038        super(
039            errorSourceJsonObject, propertyName, expectedJsonType, JsonValue.NULL,
040            methodReturnJavaType, "Attempt to assign Java-Null to a Java-Primitive Type"
041        );
042    }
043
044    /**
045     * Constructs a {@code JsonNullPrimitiveObjException} with the specified detail message, and
046     * user-provided convenience-field values.
047     * 
048     * @param message the detail message.
049     * @param errorSourceJsonObject <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_ESJO>
050     * @param propertyName          <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_PN>
051     * @param expectedJsonType      <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_EJT>
052     * @param methodReturnJavaType  <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_MRJT>
053     */
054    public JsonNullPrimitiveObjException(
055            String              message,
056            JsonObject          errorSourceJsonObject,
057            String              propertyName,
058            JsonValue.ValueType expectedJsonType,
059            Class<?>            methodReturnJavaType
060        )
061    {
062        super(
063            message, errorSourceJsonObject, propertyName, expectedJsonType, JsonValue.NULL,
064            methodReturnJavaType
065        );
066    }
067}