|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.resources.impl.BasicMessageList
public class BasicMessageList
A basic implementation of a MessageList.
Orginally based on org.apache.struts.action.ActionMessages, Revision 49670.
Nested Class Summary | |
---|---|
protected static class |
BasicMessageList.MessageItem
Holds messages for a specified property. |
Field Summary |
---|
Fields inherited from interface org.apache.commons.resources.MessageList |
---|
GLOBAL_MESSAGE_KEY |
Constructor Summary | |
---|---|
BasicMessageList()
Create an empty MessageList object. |
|
BasicMessageList(MessageList messages)
Create an MessageList object initialized with the given
messages. |
|
BasicMessageList(String globalMessageKey)
Create an MessageList object initialized to use
the given value for the "global" message key. |
|
BasicMessageList(String globalMessageKey,
MessageList messages)
Create an MessageList object initialized with the given
messages and the given global message key. |
Method Summary | |
---|---|
void |
add(Message message)
Add a message to the set of messages for the "global" property. |
void |
add(MessageList messageList)
Adds the messages from the given MessageList object to
this set of messages. |
void |
add(String property,
Message message)
Add a message to the set of messages for the specified property. |
void |
clear()
Clear all messages recorded by this object. |
Iterator |
get()
Return the set of all recorded messages, without distinction by which property the messages are associated with. |
Iterator |
get(String property)
Return the set of messages related to a specific property. |
String |
getGlobalMessageKey()
|
boolean |
isAccessed()
Determines if the MessageList's messages have been accessed one or more times. |
boolean |
isEmpty()
|
Iterator |
properties()
Return the set of property names for which at least one message has been recorded. |
void |
setGlobalMessageKey(String globalMessageKey)
|
int |
size()
Return the number of messages recorded for all properties (including global messages). |
int |
size(String property)
Return the number of messages associated with the specified property. |
String |
toString()
Returns a String representation of this MessageList's [property name]=[message list] mapping. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BasicMessageList()
MessageList
object.
public BasicMessageList(String globalMessageKey)
MessageList
object initialized to use
the given value for the "global" message key.
globalMessageKey
- The new default global message keypublic BasicMessageList(MessageList messages)
MessageList
object initialized with the given
messages.
messages
- The messages to be initially added to this object.public BasicMessageList(String globalMessageKey, MessageList messages)
MessageList
object initialized with the given
messages and the given global message key.
globalMessageKey
- The new default global message keymessages
- The messages to be initially added to this object.Method Detail |
---|
public String getGlobalMessageKey()
getGlobalMessageKey
in interface MessageList
public void setGlobalMessageKey(String globalMessageKey)
setGlobalMessageKey
in interface MessageList
globalMessageKey
- The new default global message keypublic void add(String property, Message message)
add
in interface MessageList
property
- Property name (or MessageList.GLOBAL_MESSAGE_KEY)message
- The message to be addedpublic void add(Message message)
add
in interface MessageList
message
- The message to be addedpublic void add(MessageList messageList)
MessageList
object to
this set of messages. The messages are added in the order they are returned from
the properties() method. If a message's property is already in the current
MessageList
object it is added to the end of the list for that
property. If a message's property is not in the current list it is added to the end
of the properties.
add
in interface MessageList
messageList
- The MessageList
object to be added.public void clear()
clear
in interface MessageList
public boolean isAccessed()
true
if the get()
or
get(String)
methods are called.
isAccessed
in interface MessageList
true
if the messages have been accessed one or more
times.public boolean isEmpty()
isEmpty
in interface MessageList
true
if there are no messages recorded
in this collection, or false
otherwise.public Iterator get()
get
in interface MessageList
public Iterator get(String property)
get
in interface MessageList
property
- Property name
public Iterator properties()
MessageList.GLOBAL_MESSAGE
will be one of the returned
property names.
properties
in interface MessageList
public int size()
isEmpty()
if all you care about is whether or not there are
any messages at all.
size
in interface MessageList
public int size(String property)
size
in interface MessageList
property
- Property name (or MessageList.GLOBAL_MESSAGE_KEY
public String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |