Revision 20100 branches/v10/libraries/libIverUtiles/src/com/iver/utiles/ExceptionDescription.java
ExceptionDescription.java | ||
---|---|---|
59 | 59 |
package com.iver.utiles; |
60 | 60 |
|
61 | 61 |
/** |
62 |
* A Exception could be caused for many reasons. <br> |
|
63 |
* All exception instances that we want to give more information will have a |
|
64 |
* ExceptionDescription, which will describe the cause of the error, so we'll |
|
65 |
* have more information to give to user. |
|
62 |
* <p>Most exceptions produced in a layer, has common information (layer name, driver name, error description, error code).</p> |
|
66 | 63 |
* |
64 |
* <p>An <code>ExceptionDescription</code> can provide this extra information describing the cause of the |
|
65 |
* error, and more useful information to give to the user that works with a layer.<p> |
|
66 |
* |
|
67 | 67 |
* @author azabala |
68 |
* |
|
69 | 68 |
*/ |
70 | 69 |
public abstract class ExceptionDescription { |
71 |
|
|
70 |
/** |
|
71 |
* <p>Code which identifies the kind of error which is the cause of this exception.</p> |
|
72 |
*/ |
|
72 | 73 |
private int errorCode; |
73 | 74 |
|
74 | 75 |
/** |
75 |
* Descriptive exception description for the programmer.
|
|
76 |
* <p>A description about the error which produced this exception.</p>
|
|
76 | 77 |
*/ |
77 | 78 |
private String errorDescription; |
79 |
|
|
80 |
/** |
|
81 |
* <p>If this exception was produced using a driver, this attribute describes that driver.</p> |
|
82 |
*/ |
|
78 | 83 |
private String driverName; |
84 |
|
|
85 |
/** |
|
86 |
* <p>If this exception was produced using a layer, this attribute describes that layer.</p> |
|
87 |
*/ |
|
79 | 88 |
private String layerName; |
80 | 89 |
|
90 |
/** |
|
91 |
* <p>Gets the name of the driver (if a driver was using) which this exception was produced.</p> |
|
92 |
* |
|
93 |
* @return the name of the driver (if a driver was using) which this exception was produced |
|
94 |
*/ |
|
81 | 95 |
public String getDriverName() { |
82 | 96 |
return driverName; |
83 | 97 |
} |
98 |
|
|
99 |
/** |
|
100 |
* <p>Sets the name of the driver (if a driver was using) which this exception was produced.</p> |
|
101 |
* |
|
102 |
* @param driverName the name of the driver (if a driver was using) which this exception was produced |
|
103 |
*/ |
|
84 | 104 |
public void setDriverName(String driverName){ |
85 | 105 |
this.driverName = driverName; |
86 | 106 |
} |
107 |
|
|
108 |
/** |
|
109 |
* <p>Gets the name of the layer (if a layer was using) with that this exception was produced.</p> |
|
110 |
* |
|
111 |
* @return the name of the layer (if a layer was using) with that this exception was produced |
|
112 |
*/ |
|
87 | 113 |
public String getLayerName() { |
88 | 114 |
return driverName; |
89 | 115 |
} |
116 |
|
|
117 |
/** |
|
118 |
* <p>Sets the name of the layer (if a layer was using) with that this exception was produced.</p> |
|
119 |
* |
|
120 |
* @param layerName the name of the layer (if a layer was using) with that this exception was produced |
|
121 |
*/ |
|
90 | 122 |
public void setLayerName(String layerName){ |
91 | 123 |
this.layerName = layerName; |
92 | 124 |
} |
125 |
|
|
126 |
/** |
|
127 |
* <p>Creates a new <code>ExceptionDescription</code> with no value initialized.</p> |
|
128 |
*/ |
|
93 | 129 |
public ExceptionDescription() { |
94 | 130 |
} |
95 | 131 |
|
132 |
/** |
|
133 |
* <p>Creates a new <code>ExceptionDescription</code> with the useful values initialized.</p> |
|
134 |
* |
|
135 |
* @param errorCode code which identifies the kind of error which is the cause of this exception |
|
136 |
* @param errorDescription description about the error which produced this exception |
|
137 |
*/ |
|
96 | 138 |
public ExceptionDescription(int errorCode, String errorDescription) { |
97 | 139 |
this.errorCode = errorCode; |
98 | 140 |
this.errorDescription = errorDescription; |
99 | 141 |
} |
100 | 142 |
|
143 |
/** |
|
144 |
* <p>Sets the code which identifies the kind of error which is the cause of this exception.</p> |
|
145 |
* |
|
146 |
* @param errorCode code which identifies the kind of error which is the cause of this exception |
|
147 |
*/ |
|
101 | 148 |
public void setCode(int errorCode) { |
102 | 149 |
this.errorCode = errorCode; |
103 | 150 |
} |
104 | 151 |
|
152 |
/** |
|
153 |
* <p>Sets the description about the error which produced this exception.</p> |
|
154 |
* |
|
155 |
* @param description description about the error which produced this exception |
|
156 |
*/ |
|
105 | 157 |
public void setDescription(String description) { |
106 | 158 |
this.errorDescription = description; |
107 | 159 |
} |
108 | 160 |
|
161 |
/** |
|
162 |
* <p>Gets the code which identifies the kind of error which is the cause of this exception.</p> |
|
163 |
* |
|
164 |
* @return code which identifies the kind of error which is the cause of this exception |
|
165 |
*/ |
|
109 | 166 |
public int getErrorCode() { |
110 | 167 |
return errorCode; |
111 | 168 |
} |
112 | 169 |
|
170 |
/** |
|
171 |
* <p>Gets the description about the error which produced this exception.</p> |
|
172 |
* |
|
173 |
* @return description about the error which produced this exception |
|
174 |
*/ |
|
113 | 175 |
public String getErrorDescription() { |
114 | 176 |
return errorDescription; |
115 | 177 |
} |
116 | 178 |
|
179 |
/** |
|
180 |
* <p>Returns a message that describes the error which produced this exception, formatted in HTML code.</p> |
|
181 |
* |
|
182 |
* @return message that describes the error which produced this exception, formatted in HTML code |
|
183 |
*/ |
|
117 | 184 |
public abstract String getHtmlErrorMessage(); |
118 | 185 |
|
119 | 186 |
} |
Also available in: Unified diff