Class NfbCheckedException.Code

java.lang.Object
com.nfbsoftware.exception.NfbCheckedException.Code
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
XmlDocumentCheckedException.Code
Enclosing class:
NfbCheckedException

protected abstract static class NfbCheckedException.Code extends Object implements Serializable
Represents a checkedException code. This class is used to enforce the practice of using a code defined for an exception class. Instances of the exception cannot be constructed without providing a valid code. Subclasses of this class must implement a subclass of this protected class. Typically, subclass constructors will take this Code subclass in an internal Codes interface.
Author:
Brendan Clemenzi
See Also:
  • Constructor Details

    • Code

      protected Code(String code, NfbCheckedException.Code mappedCode, String message, int severity)
      The protected constructor ensures that no instances of this class are constructed outside of the exception class or its children.
      Parameters:
      code - the code
      mappedCode - the top-level code that this code should map to
      message - the default message
      severity - the severity
  • Method Details

    • getCode

      public String getCode()
      Returns the code's value
      Returns:
      the code's value
    • getMappedCode

      public NfbCheckedException.Code getMappedCode()
      Returns the code's mapped code
      Returns:
      the code's mapped code value
    • getMessage

      public String getMessage()
      Returns the code's default message.
      Returns:
      the code's default message
    • getSeverity

      public int getSeverity()
      Returns the code's severity
      Returns:
      the code's severity
    • toString

      public String toString()
      Returns the Code's value as a String.
      Overrides:
      toString in class Object
      Returns:
      the code's value