public abstract class BaseException extends Exception implements IBaseException
Modifier and Type | Field and Description |
---|---|
protected long |
code
Unique code of error.
|
protected String |
formatString
TODO: remove the variable, use the Exception get/setMessage() instead.
|
protected String |
messageKey |
Constructor and Description |
---|
BaseException()
Deprecated.
|
BaseException(String message,
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(String message,
Throwable cause,
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 |
---|---|
long |
getCode() |
String |
getFormatString() |
String |
getLocalizedMessage()
Returns the translated message that describes the exception.
|
String |
getLocalizedMessage(ExceptionTranslator translator,
int indent)
Returns the translated message that
describes the exception with indentation.
|
String |
getLocalizedMessageStack()
Crosses the exceptions chained through cause
to conform the compound message in the corresponding language.
|
String |
getLocalizedMessageStack(ExceptionTranslator translator,
int indent)
Crosses the exceptions chained through cause
to conform the compound message in the corresponding language.
|
String |
getMessage()
Returns the message that describes the exception.
|
String |
getMessage(int indent)
Returns the message that describes the exception, with indentation.
|
String |
getMessageKey() |
String |
getMessageStack()
Crosses the exceptions chained through cause to conform
the message.
|
String |
getMessageStack(int indent)
Crosses the exceptions chained through cause to conform
the compound message with indentation.
|
Object |
getValue(String name) |
Iterator |
iterator() |
void |
setCode(long code)
Sets the exception's code.
|
void |
setFormatString(String formatString)
Sets the format string.
|
void |
setMessageKey(String messageKey)
Sets the property messageKey.
|
static void |
setTranslator(ExceptionTranslator translator)
Sets the property translator.
|
static void |
setTranslator(Object translator) |
protected void |
setValue(String name,
Object value) |
protected Map |
values() |
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
protected String messageKey
protected String formatString
protected long code
public BaseException()
public BaseException(String message, 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(String message, Throwable cause, 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 String getMessage()
IBaseException
getMessage
in interface IBaseException
getMessage
in class Throwable
public String getMessage(int indent)
IBaseException
getMessage
in interface IBaseException
indent
- Quantity of blanks to insert
at the start of the message.public String getLocalizedMessage()
IBaseException
getLocalizedMessage
in interface IBaseException
getLocalizedMessage
in class Throwable
public 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 String getMessageStack()
IBaseException
getMessageStack
in interface IBaseException
public String getMessageStack(int indent)
IBaseException
getMessageStack
in interface IBaseException
indent
- Quantity of blanks to insert
at the start of the messages.public String getLocalizedMessageStack()
IBaseException
getLocalizedMessageStack
in interface IBaseException
public 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)
public String getFormatString()
getFormatString
in interface IBaseException
public void setFormatString(String formatString)
formatString
- public String getMessageKey()
getMessageKey
in interface IBaseException
public void setMessageKey(String messageKey)
messageKey
- public Iterator iterator()
iterator
in interface IBaseException
protected Map values()
public Object getValue(String name)
getValue
in interface IBaseException
public static void setTranslator(ExceptionTranslator translator)
translator
- It(He,She) is used to translate the messages associated with
the exceptions.public static void setTranslator(Object translator)