| |
|
| java.lang.Object com.metaboss.enterprise.messages.DefaultMessageImplementation
DefaultMessageImplementation | abstract public class DefaultMessageImplementation implements Message(Code) | | Default implementation of the message object. It can be used as a base class
for the concrete messages as follows :
public class GreetingMessage extends DefaultMessageImplementation
{
private UserName mUserName;
// Construct an instance of the greeting message
public GreetingMessage(UserName pUserName)
{
super("HatMaker.Crm.Core.Greeting", false, false);
mUserName = pUserName;
}
// Overridden to return array of message arguments used to render the message.
public Object[] getMessageArguments()
{
return new Object[] { mUserName.toPrimitiveValue(); };
}
// Get the user name name
public UserName getUserName()
{
return mUserName;
}
}
The only method, which subclass might want to override is getMessageArguments().
|
Constructor Summary | |
public | DefaultMessageImplementation(String pMessageId, boolean pIsFailure, boolean pIsError, boolean pIsWarning) Constructs message object with specifed attrributes. |
Method Summary | |
public String | getId() Returns unique string Id of the message. | public Object[] | getMessageArguments() Returns an array of message arguments used to render the message.
This version returns no arguments. | public String | getTextResourceId() Getter for the unique identifier of the text resource where message text is. | public String | getTextResourcePackage() Getter for the package name of the resource bundle where where text resource should be loaded from. | public boolean | isError() Returns true if this message is an error message. | public boolean | isFailure() Returns true if this message is a failure message. | public boolean | isWarning() Returns true if this message is a warning message. | public void | setTextResourceId(String pTextResourceId) Setter for unique identifier of the text resource where message text is. | public void | setTextResourcePackage(String pTextResourcePackage) Setter for the package name of the resource bundle where where text resource should be loaded from. | public String | toLocalizedString(Locale pDesiredLocale) Returns human readable message text in specified locale. | public String | toString() Returns human readable message text in default locale. |
DefaultMessageImplementation | public DefaultMessageImplementation(String pMessageId, boolean pIsFailure, boolean pIsError, boolean pIsWarning)(Code) | | Constructs message object with specifed attrributes. This version of constructor assumes that the
text resource bundle resides in the same package as the mesage class and that the text resource is equals the message id.
This is really the most common occurrntce.
Parameters: pMessageId - - the unique identifier of the message. Parameters: pIsFailure - - mutually exclusive with pIsError and pIsWarning parameters. Set to true if this message represents failure. Parameters: pIsError - - mutually exclusive with pIsWarning and pIsFailure parameters. Set to true if this message represents error. Parameters: pIsWarning - - mutually exclusive with pIsError and pIsFailure parameters. Set to true if this message represents warning. |
getId | public String getId()(Code) | | Returns unique string Id of the message.
|
getMessageArguments | public Object[] getMessageArguments()(Code) | | Returns an array of message arguments used to render the message.
This version returns no arguments. Override to provide arguments relevant for the message.
|
getTextResourceId | public String getTextResourceId()(Code) | | Getter for the unique identifier of the text resource where message text is.
|
getTextResourcePackage | public String getTextResourcePackage()(Code) | | Getter for the package name of the resource bundle where where text resource should be loaded from.
|
isError | public boolean isError()(Code) | | Returns true if this message is an error message.
|
isFailure | public boolean isFailure()(Code) | | Returns true if this message is a failure message.
|
isWarning | public boolean isWarning()(Code) | | Returns true if this message is a warning message.
|
setTextResourceId | public void setTextResourceId(String pTextResourceId)(Code) | | Setter for unique identifier of the text resource where message text is.
|
setTextResourcePackage | public void setTextResourcePackage(String pTextResourcePackage)(Code) | | Setter for the package name of the resource bundle where where text resource should be loaded from.
|
toLocalizedString | public String toLocalizedString(Locale pDesiredLocale)(Code) | | Returns human readable message text in specified locale.
|
toString | public String toString()(Code) | | Returns human readable message text in default locale.
|
|
|
|