com.sonalb
Interface IEnhancedException

All Known Implementing Classes:
EnhancedException, EnhancedIOException, EnhancedRuntimeException, MalformedCookieException

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 :-

Following are some guidelines for implementations :-

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.

Author:
Sonal Bansal
See Also:
Exception, EnhancedException, EnhancedIOException

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

java.lang.String getOriginClass()
Returns the fully-qualified name of the class which constructed this instance.

Returns:
the String representing the class of origin ; "UNKNOWN" if it was not set.

getOriginMethod

java.lang.String getOriginMethod()
Returns the name of the method in which this instance was constructed.

Returns:
the String representing the method of origin ; "UNKNOWN" if it was not set.

getCode

java.lang.String getCode()
Returns the application-specific error code associated with this instance.

Returns:
the String representing the error code ; "UNSPECIFIED" if it was not set.

getCausalException

java.lang.Exception getCausalException()
Returns the underlying Exception (if any) for this instance.

Returns:
the underlying (causal) Exception ; null if there is none.

getDataObject

java.lang.Object getDataObject()
Returns the data object (if any) set by the originator.

Returns:
the Object ; null if there is none.

removeDataObject

void removeDataObject()
Removes the data object (if any) contained in this instance.