Package org.refcodes.exception
Class AbstractRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.refcodes.exception.AbstractRuntimeException
-
- All Implemented Interfaces:
ErrorCodeAccessor
,Trap
- Direct Known Subclasses:
BugException
,IntegrityException
,LockedException.LockedRuntimeException
,VerifyRuntimeException
,VetoException.VetoRuntimeException
public abstract class AbstractRuntimeException extends java.lang.RuntimeException implements Trap
Base exception for runtime (unchecked) / predictable (testable states) exceptions, providing functionality for exception specific multi-language messages. Regarding unchecked exception, "The Java Programming Language", by Gosling, Arnold, and Holmes says "... Unchecked runtime exceptions represent conditions that, generally speaking, reflect errors in your program's logic and cannot be reasonably recovered from at run time ...". Though you as a programmer can take care by according (business) logic to prevent such exception. Such exceptions may be accessing disposed components or any other cause where you can test a state beforehand.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.exception.ErrorCodeAccessor
ErrorCodeAccessor.ErrorCodeBuilder<B extends ErrorCodeAccessor.ErrorCodeBuilder<B>>, ErrorCodeAccessor.ErrorCodeMutator, ErrorCodeAccessor.ErrorCodeProperty
-
-
Constructor Summary
Constructors Constructor Description AbstractRuntimeException(java.lang.String message)
Instantiates a new abstract runtime exception.AbstractRuntimeException(java.lang.String aMessage, java.lang.String aErrorCode)
AbstractRuntimeException(java.lang.String message, java.lang.Throwable cause)
Instantiates a new abstract runtime exception.AbstractRuntimeException(java.lang.String aMessage, java.lang.Throwable aCause, java.lang.String aErrorCode)
AbstractRuntimeException(java.lang.Throwable cause)
Instantiates a new abstract runtime exception.AbstractRuntimeException(java.lang.Throwable aCause, java.lang.String aErrorCode)
/**
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getErrorCode()
Provides the according exception code.
-
-
-
Constructor Detail
-
AbstractRuntimeException
public AbstractRuntimeException(java.lang.String message, java.lang.Throwable cause)
Instantiates a new abstract runtime exception.- Parameters:
message
- the messagecause
- the cause
-
AbstractRuntimeException
public AbstractRuntimeException(java.lang.String message)
Instantiates a new abstract runtime exception.- Parameters:
message
- the message
-
AbstractRuntimeException
public AbstractRuntimeException(java.lang.Throwable cause)
Instantiates a new abstract runtime exception.- Parameters:
cause
- the cause
-
AbstractRuntimeException
public AbstractRuntimeException(java.lang.String aMessage, java.lang.Throwable aCause, java.lang.String aErrorCode)
- Parameters:
aMessage
- - the detail message (which is saved for later retrieval by the Throwable.getMessage() method).aCause
- - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)aErrorCode
- The exception code to be assigned to the exception. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.
-
AbstractRuntimeException
public AbstractRuntimeException(java.lang.String aMessage, java.lang.String aErrorCode)
- Parameters:
aMessage
- - the detail message (which is saved for later retrieval by the Throwable.getMessage() method).aErrorCode
- The exception code to be assigned to the exception. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.
-
AbstractRuntimeException
public AbstractRuntimeException(java.lang.Throwable aCause, java.lang.String aErrorCode)
/**- Parameters:
aCause
- - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)aErrorCode
- The exception code to be assigned to the exception. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.
-
-
Method Detail
-
getErrorCode
public java.lang.String getErrorCode()
Provides the according exception code. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.- Specified by:
getErrorCode
in interfaceErrorCodeAccessor
- Returns:
- The exception code in question.
-
-