com.zphinx.spine.message
Class DisplayMessages

java.lang.Object
  extended by com.zphinx.spine.message.DisplayMessages
All Implemented Interfaces:
Serializable

public class DisplayMessages
extends Object
implements Serializable

DisplayMessages is a container for a collection of messages each identified by a unique key. It serves as a repository for both DisplayMessage and DisplayError objects and returns arrays of both types of message objects.

This object contains counters which contain the following information:

Version:
$1.0

Copyright ©Zphinx Software Solutions

Author:
David Ladapo
See Also:
Serialized Form

Constructor Summary
DisplayMessages()
          Public Constructor
DisplayMessages(Locale locale)
          Constructs a DisplayMessages with a given locale
 
Method Summary
 void add(String key, DisplayMessage value)
          Adds a message to this object, by setting a key with which the message and other messages of the same key will be saved.
 void add(String key, DisplayMessage value, Locale locale)
          Adds a message to this object, by setting a key under which the message and other messages of the same key will be saved.
 void clear()
          Clears all entries in this object
 boolean containsErrors()
          Checks to see if any errors are stored in this object
 boolean containsKey(String key)
          Checks to see that this key is available within this object
 boolean containsMessages()
          Checks to see if any messages are stored in this object
 int errorKeySize()
          Gets the size of the error keys in this collection
 String getAllErrorString()
          Gets all the errors as a string seperated by a carriage return character
 String getAllMessageString()
          Gets all the messages as a string seperated by a carriage return character
 DisplayError[] getErrors(String key)
          Gets all the errors identified by the given key
 DisplayMessage[] getMessages(String key)
          Gets all the messages identified by the given key
 boolean isEmpty()
          Checks if this object contains any entries
 Set keySet()
          Gets a collection of all the keys in this DisplayMessages object
 int messageKeySize()
          Gets the size of the message keys in this collection
 boolean remove(String key)
          Removes this key and it's value from this object
 int size()
          Gets the size of this collection
 String toString()
          The string representation of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DisplayMessages

public DisplayMessages()
Public Constructor


DisplayMessages

public DisplayMessages(Locale locale)
Constructs a DisplayMessages with a given locale

Parameters:
locale - The Locale to use for creating messages
Method Detail

clear

public void clear()
Clears all entries in this object


containsKey

public boolean containsKey(String key)
Checks to see that this key is available within this object

Parameters:
key - The key to search for within this object
Returns:
True if this key is available within this object
See Also:
HashMap.containsKey(java.lang.Object)

getErrors

public DisplayError[] getErrors(String key)
Gets all the errors identified by the given key

Parameters:
key - The key which identifies the errors
Returns:
The array of DisplayErrors saved under the given key

getMessages

public DisplayMessage[] getMessages(String key)
Gets all the messages identified by the given key

Parameters:
key - The key under which the message are saved
Returns:
The array of DisplayErrors saved using the given key

isEmpty

public boolean isEmpty()
Checks if this object contains any entries

Returns:
true if this object contains no entries

containsMessages

public boolean containsMessages()
Checks to see if any messages are stored in this object

Returns:
true if this object contains at least one Display message object

containsErrors

public boolean containsErrors()
Checks to see if any errors are stored in this object

Returns:
True if this object contains at least one display error object

add

public void add(String key,
                DisplayMessage value)
Adds a message to this object, by setting a key with which the message and other messages of the same key will be saved. Both messages and errors are saved using different keys.

Parameters:
key - The key by which this message is saved
value - The message or error object to be saved

add

public void add(String key,
                DisplayMessage value,
                Locale locale)
Adds a message to this object, by setting a key under which the message and other messages of the same key will be saved. Both messages and errors are saved under different keys.

Parameters:
key - The key by which this message is saved
value - The message or error object to be saved
locale - The locale in which this message exists

remove

public boolean remove(String key)
Removes this key and it's value from this object

Parameters:
key - The key which we wish to remove
Returns:
True if this object was successfully removed and false if it does not exist within the collection

size

public int size()
Gets the size of this collection

Returns:
The size of this collection

messageKeySize

public int messageKeySize()
Gets the size of the message keys in this collection

Returns:
The size of the message keys in this collection

errorKeySize

public int errorKeySize()
Gets the size of the error keys in this collection

Returns:
The size of the error keys in this collection

toString

public String toString()
The string representation of this object

Overrides:
toString in class Object
Returns:
The string representation of this object

keySet

public Set keySet()
Gets a collection of all the keys in this DisplayMessages object

Returns:
A Set of all the keys in this DisplayMessages
See Also:
HashMap.keySet()

getAllErrorString

public String getAllErrorString()
Gets all the errors as a string seperated by a carriage return character

Returns:
All the errors as a string seperated by a carriage return character

getAllMessageString

public String getAllMessageString()
Gets all the messages as a string seperated by a carriage return character

Returns:
All the messages as a string seperated by a carriage return character