|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.sonalb.EnhancedRuntimeException
public class EnhancedRuntimeException
Convenience implementation of IEnhancedException
interface, and subclass of RuntimeException
.
Setter methods for the error code, causal Exception, class and
method of origin, and data Object are provided. However, once these
fields have been set, any subsequent calls to the respective setters
throws an UnsupportedOperationException
.
IEnhancedException
,
RuntimeException
,
Serialized FormConstructor Summary | |
---|---|
EnhancedRuntimeException()
Constructs a "plain vanilla" EnhancedRuntimeException. |
|
EnhancedRuntimeException(java.lang.Exception under)
Constructs an EnhancedRuntimeException with the specified causal Exception. |
|
EnhancedRuntimeException(java.lang.String s)
Constructs an EnhancedRuntimeException with a short detail message. |
|
EnhancedRuntimeException(java.lang.String s,
java.lang.Exception under)
Constructs an EnhancedRuntimeException with the specified detail message and causal Exception. |
|
EnhancedRuntimeException(java.lang.String s,
java.lang.Exception under,
java.lang.String code,
java.lang.Object o,
java.lang.String method)
Constructs an EnhancedRuntimeException with a detail message, causal Exception, error code, class and method of origin. |
|
EnhancedRuntimeException(java.lang.String code,
java.lang.Object o,
java.lang.String method)
Constructs an EnhancedRuntimeException with an error code and, class and method of origin. |
|
EnhancedRuntimeException(java.lang.String s,
java.lang.String code,
java.lang.Object o,
java.lang.String method)
Constructs an EnhancedRuntimeException with a detail message, error code, class and method of origin. |
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. |
void |
setCausalException(java.lang.Exception e)
Sets the underlying (causal) Exception for this instance. |
void |
setCode(java.lang.String c)
Sets the error-code which identifies the particular error condition that triggered this exception. |
void |
setDataObject(java.lang.Object o)
Sets the data Object which will be passed up the call stack. |
void |
setOriginClass(java.lang.Object o)
Sets the class of origin for this instance. |
void |
setOriginMethod(java.lang.String meth)
Sets the method of origin for this instance. |
java.lang.String |
toString()
Returns a short description of this instance. |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EnhancedRuntimeException()
public EnhancedRuntimeException(java.lang.String s)
s
- the detail message.public EnhancedRuntimeException(java.lang.Exception under)
under
- the causal Exception.Exception
public EnhancedRuntimeException(java.lang.String s, java.lang.Exception under)
under
- the causal Exception.s
- the detail message.Exception
public EnhancedRuntimeException(java.lang.String s, java.lang.Exception under, java.lang.String code, java.lang.Object o, java.lang.String method)
...
throw new EnhancedRuntimeException("Failed to connect to server", excp, "SVR_0090", this, "connect");
...
under
- the causal Exception.s
- the detail message.code
- the error-code.o
- the Object from which the class of origin is determined.method
- the method of origin.Exception
public EnhancedRuntimeException(java.lang.String code, java.lang.Object o, java.lang.String method)
...
throw new EnhancedRuntimeException("SVR_0090", this, "connect");
...
code
- the error-code.o
- the Object from which the class of origin is determined.method
- the method of origin.public EnhancedRuntimeException(java.lang.String s, java.lang.String code, java.lang.Object o, java.lang.String method)
...
throw new EnhancedRuntimeException("Failed to connect to server", "SVR_0090", this, "connect");
...
under
- the causal Exception.s
- the detail message.code
- the error-code.o
- the Object from which the class of origin is determined.method
- the method of origin.Exception
Method Detail |
---|
public java.lang.Exception getCausalException()
IEnhancedException
Exception
(if any) for this instance.
getCausalException
in interface IEnhancedException
Exception
;
null
if there is none.public java.lang.String getOriginClass()
IEnhancedException
getOriginClass
in interface IEnhancedException
String
representing the class of origin ;
"UNKNOWN" if it was not set.public java.lang.String getOriginMethod()
IEnhancedException
getOriginMethod
in interface IEnhancedException
String
representing the method of origin ;
"UNKNOWN" if it was not set.public java.lang.String getCode()
IEnhancedException
getCode
in interface IEnhancedException
String
representing the error code ;
"UNSPECIFIED" if it was not set.public void setDataObject(java.lang.Object o) throws java.lang.UnsupportedOperationException
o
- the data Object.
java.lang.UnsupportedOperationException
- Thrown if the data Object has already been set.public java.lang.Object getDataObject()
IEnhancedException
getDataObject
in interface IEnhancedException
Object
; null
if there is none.public void removeDataObject()
IEnhancedException
removeDataObject
in interface IEnhancedException
public void setCode(java.lang.String c) throws java.lang.UnsupportedOperationException
c
- the error code.
java.lang.UnsupportedOperationException
- Thrown if the error code has already been set.public void setOriginClass(java.lang.Object o) throws java.lang.UnsupportedOperationException
Class
, then the class of origin is taken as
o.getName().
o
- the Object representing the class of origin.
java.lang.UnsupportedOperationException
- Thrown if the class of origin has already been set.Class
public void setOriginMethod(java.lang.String meth) throws java.lang.UnsupportedOperationException
meth
- the String representing the method of origin.
java.lang.UnsupportedOperationException
- Thrown if the method of origin has already been set.public void setCausalException(java.lang.Exception e) throws java.lang.UnsupportedOperationException
e
- the Exception representing the causal Exception.
java.lang.UnsupportedOperationException
- Thrown if the causal Exception has already been set.public java.lang.String toString()
RuntimeException.toString()
.
Otherwise, the returned String is formed by concatenating the following :-Throwable.getMessage()
method for this object
toString
in class java.lang.Throwable
String
representation of this EnhancedRuntimeException
.Throwable.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |