public abstract class AbstractMessage extends Object implements Message
Message.| Modifier and Type | Field and Description |
|---|---|
private String |
code |
private String |
details |
private NlsMessage |
message |
private static long |
serialVersionUID
UID for serialization.
|
private String |
source |
private UUID |
uuid |
TYPE_INFORMATION, TYPE_TECHNICAL_ERROR, TYPE_USER_ERROR, TYPE_VALIDATION_FAILURE, TYPE_WARNING| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMessage()
The constructor for de-serialization in GWT.
|
|
AbstractMessage(String code,
Object source,
NlsMessage message,
UUID uuid,
String details)
The constructor.
|
|
AbstractMessage(String code,
Object source,
String message,
UUID uuid,
String details)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getCode()
This method gets the code that identifies the detailed type of this object.
|
String |
getDetails()
This method gets optional details for this message.
|
String |
getMessage()
This method gets the actual message that describes this object.
|
String |
getMessage(Locale locale)
|
String |
getSource()
This method gets the (optional) source of the message.
|
UUID |
getUuid()
This method gets the
UUID of this object. |
String |
toString() |
private static final long serialVersionUID
private String source
getSource()private NlsMessage message
getMessage(java.util.Locale)private String details
getDetails()protected AbstractMessage()
public AbstractMessage(String code, Object source, String message, UUID uuid, String details)
public String getCode()
UUID or ID are typically unique per
instance of an object the code is unique for all instances of the exact same kind. So e.g. a particular
kind of exception or
ValidationFailure can be identified by its code. A simple generic
implementation may return the classname or the key of the NLS message. However, the code should remain
stable after refactoring (so at least after the rename the previous code should be returned as
String literal). This code may be used as a compact identifier to reference the related problem
or information as well as for automatic tests of error situations that should remain stable even if the
message text gets improved or the locale is unknown.getCode in interface AttributeReadMessageCodeThrowable.getMessage(),
NlsThrowable,
Messagepublic String getSource()
messages displayed to end-users. This will help to find
the problem easier.public final String getMessage()
technical and should help operators or
developers to identify what happened or it will be information displayed to end-users and should be clear
and easy to understand. For internationalization see Message and
NlsMessage. In any case it should NOT contain sensitive information such
as passwords or (detailed) personal data.getMessage in interface AttributeReadMessageThrowable.getMessage(),
NlsThrowable,
Messagepublic String getMessage(Locale locale)
message localized for the given Locale. NLS. On
client side (e.g. for GWT clients) only a single locale may be supported at a time and this method may
behave like AttributeReadMessage.getMessage() ignoring the Locale.getMessage in interface Messagelocale - is the Locale.public String getDetails()
getDetails in interface Messagenull if no additional details are available.public UUID getUuid()
UUID of this object. When the object is created, a UUID is
generated. In case the object is created from another object that already has a UUID,
the existing UUID will be used (e.g. for chained
exceptions). UUID will appear in a
stacktrace but NOT in the message. It
will therefore be written to log-files if the NlsThrowable is
logged. If you supply the UUID to the end-user in an error panel or popup (see
Message), he can provide it with the problem report so an administrator
or software developer can easily find the stacktrace in the log-files.getUuid in interface AttributeReadUuidgetUuid in interface MessageUUID if this Message. Will typically only be available if type is Message.TYPE_TECHNICAL_ERROR or Message.TYPE_USER_ERROR. Will be null if
not available.Copyright © 2001–2015 mmm-Team. All rights reserved.