001package Torello.Browser;
002
003/**
004 * Abstract ancestor exception class for exceptions which check the integrity of instances of
005 * both CDP types and CDP events. 
006 * 
007 * <BR /><BR />
008 * Of significant note, when the Browser transmits an object type or event to the
009 * {@code Torello.Browser} packages, the Web-Sockets layer parses the Json, and performs a "best 
010 * efforts" attempt at constructing an object.  
011 * 
012 * <BR /><BR />
013 * Because throwing exceptions from within the Web-Sockets processing classes and code would cause 
014 * an unacceptable level of complexity, and and all classes received from Google's or a compatible
015 * Web-Browser <B STYLE='color:red'>are not checked for integrity</B>, but rather constructed and 
016 * returned to the user "as is.".
017 * 
018 * <BR /><BR />
019 * Data Integrity consists of two separate requirements:
020 * 
021 * <BR /><BR /><UL CLASS=JDUL>
022 * 
023 * <LI> All type and event class fields which have not been declared
024 *      <B STYLE='color:red;'><I>optional</B></I> must have a value assigned to their
025 *      fields, and contain {@code 'TRUE'} within their respective
026 *      {@link BaseType#isPresent()}
027 *      list.
028 *      </LI>
029 * 
030 * <LI> Any type or event class fields which have been assigned to a type which has a correlated
031 *      <B STYLE='color:red;'><I>Enumerated String List</B></I> must contain a string that is 
032 *      listed among the elements of the specified list.
033 *      </LI>
034 * 
035 * </UL>
036 * 
037 * @see BaseType#optionalsValidate()
038 * @see BaseType#optionalsValidateThrow()
039 * @see BaseType#isPresent()
040 * @see BaseType#enumStrValidate()
041 * @see BaseType#enumStrValidateThrow()
042 * @see NestedHelper#enumStrValidate(BaseType)
043 */
044public abstract class DataIntegrityException extends RuntimeException
045{
046    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX>  */
047    public static final long serialVersionUID = 1;
048
049    /** Constructs a {@code DataIntegrityException} with no detail message. */
050    protected DataIntegrityException()
051    { super(); }
052
053    /**
054     * Constructs a {@code DataIntegrityException} with the specified detail message.
055     * @param message the detail message.
056     */
057    protected DataIntegrityException(String message)
058    { super(message); }
059
060    /**
061     * Constructs a new {@code DataIntegrityException} with the specified detail message and cause.
062     *
063     * <BR /><BR /><DIV CLASS=JDHint>
064     * <B STYLE='color:red;'>Note:</B> The detail message associated with cause is not
065     * automatically incorporated into this exception's detail message.
066     * </DIV>
067     * 
068     * @param message The detail message (which is saved for later retrieval by the
069     * {@code Throwable.getMessage()} method).
070     * 
071     * @param cause the cause (which is saved for later retrieval by the
072     * {@code Throwable.getCause()} method).  (A null value is permitted, and indicates that the
073     * cause is nonexistent or unknown).
074     */
075    protected DataIntegrityException(String message, Throwable cause)
076    { super(message, cause); }
077
078    /**
079     * Constructs a new {@code DataIntegrityException} with the specified cause and a detail
080     * message of {@code (cause==null ? null : cause.toString())} (which typically contains the
081     * class and detail message of cause).
082     * 
083     * <BR /><BR />This constructor is useful for exceptions that are little more than wrappers for
084     * other throwables.
085     * 
086     * @param cause The cause (which is saved for later retrieval by the
087     * {@code Throwable.getCause()} method).  (A null value is permitted, and indicates that the
088     * cause is nonexistent or unknown).
089     */
090    protected DataIntegrityException(Throwable cause)
091    { super(cause); }
092}