View Javadoc

1   package fr.ove.openmath.exceptions;
2   
3   /***
4   * An exception to subclass to alerts application of errors or to specialize
5   * the treatment of the symbol that causes the thrown of that kind of instance.<BR>
6   * This class must be subclassed (it is an abstract class) to set the adequat error
7   * message and the possible details according to the symbol.
8   *
9   * @author © 1998 DIRAT Laurent
10  * @version 1.0  13/04/99
11  */
12  public abstract class ErrorMessageException extends RuntimeException {
13      /***
14      * The error symbol which cause this exception
15      */
16      private String symbol;
17      
18      /***
19      * The error message
20      */
21      private String errorMessage;
22      
23      /*** 
24      * The details to send with the message
25      */
26      private Object details;
27      
28      /***
29      * Do we have to throw the exception again ?
30      */
31      private boolean throwAgain = false;
32  
33      /***
34      * The constructor.
35      * @param symbol The symbol which throws the instance.
36      */
37      public ErrorMessageException(String symbol) {
38          this(symbol, null);
39      }
40  
41      /***
42      * The constructor.
43      * @param symbol The symbol which throws the instance.
44      * @param details the details of the exception
45      */
46      public ErrorMessageException(String symbol, Object details) {
47          this.symbol = symbol;
48          this.details = details;
49      }
50      
51      /***
52      * Returns the symbols which throws the instance
53      */
54      public String getSymbol() {
55          return symbol;
56      }
57      
58      /***
59      * Sets the symbol which throws the instance
60      */
61      public void setSymbol(String symbol) {
62          this.symbol = symbol;
63      }
64  
65      /***
66      * Returns the details of the exception
67      */
68      public Object getDetails() {
69          return details;
70      }
71      
72      /***
73      * Sets the details of the exception
74      */ 
75      public void setDetails(Object details) {
76          this.details = details;
77      }
78      
79      /***
80      * Sets <CODE>true</CODE> if we've got to throw the exception.<BR>
81      * <CODE>false</CODE> otherwise.
82      */
83      public void setThrowAgain(boolean throwAgain) {
84          this.throwAgain = throwAgain;
85      }
86      
87      /***
88      * Returns if we've got to throw the exception.
89      */
90      public boolean getThrowAgain() {
91          return throwAgain;
92      }
93      
94      /***
95      * Sets the error message
96      */
97      public void setErrorMessage(String errorMessage) {
98          this.errorMessage = errorMessage;
99      }
100     
101     /***
102     * Returns the error message
103     */
104     public String getErrorMessage() {
105         return errorMessage;
106     }
107 }