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