View Javadoc

1   package org.mod4j.runtime.exception;
2   
3   /**
4    * Thrown when a business rule is violated. Attribute constraints are also considered business rules.
5    * 
6    * @author Eric Jan Malotaux
7    * 
8    */
9   @SuppressWarnings("serial")
10  public class BusinessRuleException extends RuntimeException {
11  
12      /**
13       * Constructs a new business rule exception with <code>null</code> as its detail message. The cause is not
14       * initialized, and may subsequently be initialized by a call to {@link #initCause}.
15       */
16      public BusinessRuleException() {
17          super();
18      }
19  
20      /**
21       * Constructs a new business rule exception with the specified detail message and cause.
22       * <p>
23       * Note that the detail message associated with <code>cause</code> is <i>not</i> automatically incorporated in
24       * this business rule exception's detail message.
25       * 
26       * @param message
27       *            the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
28       * @param cause
29       *            the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt>
30       *            value is permitted, and indicates that the cause is nonexistent or unknown.)
31       */
32      public BusinessRuleException(String message, Throwable cause) {
33          super(message, cause);
34      }
35  
36      /**
37       * Constructs a new business rule exception with the specified detail message. The cause is not initialized, and may
38       * subsequently be initialized by a call to {@link #initCause}.
39       * 
40       * @param message
41       *            the detail message. The detail message is saved for later retrieval by the {@link #getMessage()}
42       *            method.
43       */
44      public BusinessRuleException(String message) {
45          super(message);
46      }
47  
48      /**
49       * Constructs a new business rule exception with the specified cause and a detail message of
50       * <tt>(cause==null ? null : cause.toString())</tt> (which typically contains the class and detail message of
51       * <tt>cause</tt>). This constructor is useful for business rule exceptions that are little more than wrappers
52       * for other throwables.
53       * 
54       * @param cause
55       *            the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt>
56       *            value is permitted, and indicates that the cause is nonexistent or unknown.)
57       */
58      public BusinessRuleException(Throwable cause) {
59          super(cause);
60      }
61  
62  }