|
Version 4.0.0
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objecthirondelle.web4j.model.MessageListImpl
public class MessageListImpl
General implementation of MessageList.
| Constructor Summary | |
|---|---|
MessageListImpl()
Create an empty MessageList. |
|
MessageListImpl(String aMessage)
Create a MessageList having one simple AppResponseMessage. |
|
MessageListImpl(String aMessage,
Object... aParams)
Create a MessageList having one compound AppResponseMessage. |
|
| Method Summary | |
|---|---|
void |
add(AppException ex)
Add all AppResponseMessages attached to aAppEx to this list. |
void |
add(String aMessage)
Add a simple AppResponseMessage to this list. |
void |
add(String aMessage,
Object... aParams)
Add a compound AppResponseMessage to this list. |
boolean |
getIsDisplayable()
Return true only if messages exist and MessageList.getMessagesForSingleDisplay()
has not yet been called. |
List<AppResponseMessage> |
getMessages()
Return an unmodifiable List of AppResponseMessages. |
List<AppResponseMessage> |
getMessagesForSingleDisplay()
Render the messages in a JSP. |
boolean |
isEmpty()
Return true only if there are no messages in this list. |
boolean |
isNotEmpty()
Return the negation of MessageList.isEmpty(). |
String |
toString()
Intended for debugging only. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MessageListImpl()
MessageList.
public MessageListImpl(String aMessage)
MessageList having one simple AppResponseMessage.
The argument satisfies the same conditions as AppResponseMessage.forSimple(java.lang.String).
public MessageListImpl(String aMessage,
Object... aParams)
MessageList having one compound AppResponseMessage.
The arguments satisfy the same conditions as
AppResponseMessage.forCompound(java.lang.String, java.lang.Object...).
| Method Detail |
|---|
public final void add(String aMessage)
MessageListAppResponseMessage to this list.
The argument satisfies the same conditions as AppResponseMessage.forSimple(java.lang.String).
add in interface MessageList
public final void add(String aMessage,
Object... aParams)
MessageListAppResponseMessage to this list.
The arguments satisfy the same conditions as AppResponseMessage.forCompound(java.lang.String, java.lang.Object...).
add in interface MessageListpublic final void add(AppException ex)
MessageListAppResponseMessages attached to aAppEx to this list.
add in interface MessageListpublic final List<AppResponseMessage> getMessages()
MessageListAppResponseMessages.
JSPs must call MessageList.getMessagesForSingleDisplay() instead of this method.
getMessages in interface MessageListpublic final boolean isNotEmpty()
MessageListMessageList.isEmpty().
isNotEmpty in interface MessageListpublic final boolean isEmpty()
MessageListNote that this method name conflicts with the empty keyword
of JSTL. Thus, MessageList.isNotEmpty() is supplied as an alternative.
isEmpty in interface MessageListpublic final boolean getIsDisplayable()
MessageListMessageList.getMessagesForSingleDisplay()
has not yet been called.
getIsDisplayable in interface MessageListpublic List<AppResponseMessage> getMessagesForSingleDisplay()
MessageListJSPs must call this method when rendering messages.
This method solves the following problem. Some messages need to survive a redirect. This is implemented in WEB4J by placing the messages in session scope. However, the messages should be displayed to the user only once. So the problem arises of what to do with session-scope messages once they have been displayed.
Here, the technique used is to keep the object in session scope, but if the rendering task is performed a second time on the same messages (that is, if this method is called a second time on the same object), an empty List is returned, and no text will be rendered. This is an unusual policy for an object.
getMessagesForSingleDisplay in interface MessageListMessageList.getMessages() - otherwise, return an empty List.public String toString()
toString in class Object
|
Version 4.0.0
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||