public abstract class BaseException extends java.lang.Exception implements IBaseException
Modifier and Type | Field and Description |
---|---|
protected long |
code
Unique code of error.
|
protected java.lang.String |
formatString
TODO: remove the variable, use the Exception get/setMessage() instead.
|
protected java.lang.String |
messageKey |
Constructor and Description |
---|
BaseException()
Deprecated.
|
BaseException(java.lang.String message,
java.lang.String key,
long code)
Constructs a BaseException with a default message format, a key to find a
localized message format, and a unique code to identify the exception.
|
BaseException(java.lang.String message,
java.lang.Throwable cause,
java.lang.String key,
long code)
Constructs a BaseException with a default message format, a key to find a
localized message format, and a unique code to identify the exception.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
containsCause(java.lang.Throwable ex,
java.lang.Class<? extends java.lang.Throwable> searchException) |
long |
getCode() |
java.lang.String |
getFormatString() |
static java.lang.String |
getHTMLMessageStack(java.lang.Throwable th) |
java.lang.String |
getLocalizedMessage()
Returns the translated message that describes the exception.
|
java.lang.String |
getLocalizedMessage(ExceptionTranslator translator,
int indent)
Returns the translated message that
describes the exception with indentation.
|
java.lang.String |
getLocalizedMessageStack()
Crosses the exceptions chained through cause
to conform the compound message in the corresponding language.
|
java.lang.String |
getLocalizedMessageStack(ExceptionTranslator translator,
int indent)
Crosses the exceptions chained through cause
to conform the compound message in the corresponding language.
|
java.lang.String |
getMessage()
Returns the message that describes the exception.
|
java.lang.String |
getMessage(int indent)
Returns the message that describes the exception, with indentation.
|
java.lang.String |
getMessageKey() |
java.lang.String |
getMessageStack()
Crosses the exceptions chained through cause to conform
the message.
|
java.lang.String |
getMessageStack(int indent)
Crosses the exceptions chained through cause to conform
the compound message with indentation.
|
static java.lang.String |
getMessageStack(java.lang.Throwable th,
int indent) |
java.lang.Object |
getValue(java.lang.String name) |
java.util.Iterator |
iterator() |
void |
setCode(long code)
Sets the exception's code.
|
void |
setFormatString(java.lang.String formatString)
Sets the format string.
|
void |
setMessageKey(java.lang.String messageKey)
Sets the property messageKey.
|
static void |
setTranslator(ExceptionTranslator translator)
Sets the property translator.
|
static void |
setTranslator(java.lang.Object translator) |
protected void |
setValue(java.lang.String name,
java.lang.Object value) |
protected java.util.Map |
values() |
protected java.lang.String messageKey
protected java.lang.String formatString
protected long code
public BaseException()
public BaseException(java.lang.String message, java.lang.String key, long code)
message
- the default messageFormat to describe the exceptionkey
- the key to use to search a localized messageFormnatacode
- the unique code to identify the exceptionpublic BaseException(java.lang.String message, java.lang.Throwable cause, java.lang.String key, long code)
message
- the default messageFormat to describe the exceptioncause
- the original cause of the exceptionkey
- the key to use to search a localized messageFormnatacode
- the unique code to identify the exceptionpublic java.lang.String getMessage()
IBaseException
getMessage
in interface IBaseException
getMessage
in class java.lang.Throwable
public java.lang.String getMessage(int indent)
IBaseException
getMessage
in interface IBaseException
indent
- Quantity of blanks to insert
at the start of the message.public java.lang.String getLocalizedMessage()
IBaseException
getLocalizedMessage
in interface IBaseException
getLocalizedMessage
in class java.lang.Throwable
public java.lang.String getLocalizedMessage(ExceptionTranslator translator, int indent)
IBaseException
getLocalizedMessage
in interface IBaseException
translator
- Instance of a class that fulfills
the IExceptionTranslator interface.
His method "getText" takes charge returning
the expression, correspondent to the key that
delivers him, translated into the configured language.indent
- Quantity of blanks to insert
at the start of the message.public java.lang.String getMessageStack()
IBaseException
getMessageStack
in interface IBaseException
public java.lang.String getMessageStack(int indent)
IBaseException
getMessageStack
in interface IBaseException
indent
- Quantity of blanks to insert
at the start of the messages.public static java.lang.String getHTMLMessageStack(java.lang.Throwable th)
public static java.lang.String getMessageStack(java.lang.Throwable th, int indent)
public java.lang.String getLocalizedMessageStack()
IBaseException
getLocalizedMessageStack
in interface IBaseException
public java.lang.String getLocalizedMessageStack(ExceptionTranslator translator, int indent)
IBaseException
getLocalizedMessageStack
in interface IBaseException
translator
- Instance of a class that fulfills
the IExceptionTranslator interface.
His method "getText" takes charge returning
the expression, correspondent to the key that
delivers him, translated into the configured language.indent
- Quantity of blanks to insert
at the start of the messages.public long getCode()
getCode
in interface IBaseException
public void setCode(long code)
code
- public java.lang.String getFormatString()
getFormatString
in interface IBaseException
public void setFormatString(java.lang.String formatString)
formatString
- public java.lang.String getMessageKey()
getMessageKey
in interface IBaseException
public void setMessageKey(java.lang.String messageKey)
messageKey
- public java.util.Iterator iterator()
iterator
in interface IBaseException
protected java.util.Map values()
public java.lang.Object getValue(java.lang.String name)
getValue
in interface IBaseException
protected void setValue(java.lang.String name, java.lang.Object value)
public static void setTranslator(ExceptionTranslator translator)
translator
- It(He,She) is used to translate the messages associated with
the exceptions.public static void setTranslator(java.lang.Object translator)
public static boolean containsCause(java.lang.Throwable ex, java.lang.Class<? extends java.lang.Throwable> searchException)