|
|||||||||
| Home >> All >> com >> [ sonalb overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.sonalb
Interface IEnhancedException

- All Known Implementing Classes:
- EnhancedException, EnhancedIOException, EnhancedRuntimeException
- public interface IEnhancedException
Allows implementing classes to contain an
application-specific error code, the class and
method of origin, a data Object,
and any underlying (causal) Exception.
These enhancements are described below :-
- Error Code: A unique code is assigned
to each application-specific error condition. This
code may be useful for troubleshooting, or it may
be used as a reference to allow the user to obtain
more detailed information about the particular error
condition.
- Class of origin:
- Method of origin: These two allow the
convenient determination of the class and the method
where this
IEnhancedExceptioninstance was created. - Data Object: This
Objectallows thisIEnhancedExceptioninstance to pass some information up the stack. - Causal Exception: This is the underlying exception
which is the "root cause" of this
IEnhancedException. "Exception chaining" is possible if the causal exception is also an instance ofIEnhancedException.
Following are some guidelines for implementations :-
-
In order to be useful, any implementing class should
extend
Exception(or one of its subclasses). - It is up to the implementing class to determine how it internally stores and represents the contained data (error code, data object, origin etc). These fields may be populated at construction time (via appropriate constructor arguments), or using "setter" methods, or both.
- In keeping with the purpose of the above enhancements, implementations are expected to take suitable measures to ensure that the fields are populated only once, at or near the time that this instance is created. The data Object can be removed at any time, even higher up in the call stack.
NOTE: Direct implementing classes DO NOT follow the same hierarchy
as followed by the Exceptions in the core Java packages. For example,
EnhancedIOException is NOT a direct subclass of EnhancedException,
even though IOException is a direct subclass of Exception. In other
words, (EnhancedIOException instanceof EnhancedException) returns false
even though (IOException instanceof Exception) returns true.
| Method Summary | |
java.lang.Exception |
getCausalException()
Returns the underlying Exception (if any) for this instance. |
java.lang.String |
getCode()
Returns the application-specific error code associated with this instance. |
java.lang.Object |
getDataObject()
Returns the data object (if any) set by the originator. |
java.lang.String |
getOriginClass()
Returns the fully-qualified name of the class which constructed this instance. |
java.lang.String |
getOriginMethod()
Returns the name of the method in which this instance was constructed. |
void |
removeDataObject()
Removes the data object (if any) contained in this instance. |
| Method Detail |
getOriginClass
public java.lang.String getOriginClass()
- Returns the fully-qualified name of the class which constructed
this instance.
getOriginMethod
public java.lang.String getOriginMethod()
- Returns the name of the method in which this instance was constructed.
getCode
public java.lang.String getCode()
- Returns the application-specific error code associated with this instance.
getCausalException
public java.lang.Exception getCausalException()
- Returns the underlying
Exception(if any) for this instance.
getDataObject
public java.lang.Object getDataObject()
- Returns the data object (if any) set by the originator.
removeDataObject
public void removeDataObject()
- Removes the data object (if any) contained in this instance.
|
|||||||||
| Home >> All >> com >> [ sonalb overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC