org.apache.struts.faces.util
Class MessagesMap

java.lang.Object
  extended byorg.apache.struts.faces.util.MessagesMap
All Implemented Interfaces:
java.util.Map

public class MessagesMap
extends java.lang.Object
implements java.util.Map

A limited immutable Map implementation that wraps the MessageResources instance for the specified Locale. Exposing the messages as a Map makes them easily accessible via value binding expressions, as well as JSP 2.0 expression language expressions.


Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
private  java.util.Locale locale
          The Locale for which to return messages, or null for the system default Locale.
private  org.apache.struts.util.MessageResources messages
          The MessageResources being wrapped by this MessagesMap.
 
Constructor Summary
MessagesMap(org.apache.struts.util.MessageResources messages, java.util.Locale locale)
          Construct a new MessagesMap instance that wraps the specified MessageResources instance, and returns messages for the specified Locale.
 
Method Summary
 void clear()
          The clear() method is not supported.
 boolean containsKey(java.lang.Object key)
          Return true if there is a message for the specified key.
 boolean containsValue(java.lang.Object value)
          The containsValue() method is not supported.
 java.util.Set entrySet()
          The entrySet() method is not supported.
 boolean equals(java.lang.Object o)
          The equals method checks whether equal MessageResources and Locale are being wrapped.
 java.lang.Object get(java.lang.Object key)
          Return the message string for the specified key.
(package private)  java.util.Locale getLocale()
          Return the Locale we object we are wrapping.
(package private)  org.apache.struts.util.MessageResources getMessages()
          Return the MessageResources object we are wrapping.
 int hashCode()
          The hashCode() method returns values that will be identical if the equals method returns true.
 boolean isEmpty()
          The isEmpty() method returns false, on the assumption that there is always at least one message available.
 java.util.Set keySet()
          The keySet() method is not supported.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          The put() method is not supported.
 void putAll(java.util.Map map)
          The putAll() method is not supported.
 java.lang.Object remove(java.lang.Object key)
          The remove() method is not supported.
 int size()
          The size() method is not supported.
 java.util.Collection values()
          The values() method is not supported.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locale

private java.util.Locale locale

The Locale for which to return messages, or null for the system default Locale.


messages

private org.apache.struts.util.MessageResources messages

The MessageResources being wrapped by this MessagesMap.

Constructor Detail

MessagesMap

public MessagesMap(org.apache.struts.util.MessageResources messages,
                   java.util.Locale locale)

Construct a new MessagesMap instance that wraps the specified MessageResources instance, and returns messages for the specified Locale.

Parameters:
messages - MessageResources instance to wrap
locale - Locale for which to retrieve messages, or null for the system default Locale
Throws:
java.lang.NullPointerException - if messages is null
Method Detail

clear

public void clear()

The clear() method is not supported.

Specified by:
clear in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)

Return true if there is a message for the specified key.

Specified by:
containsKey in interface java.util.Map
Parameters:
key - Message key to evaluate

containsValue

public boolean containsValue(java.lang.Object value)

The containsValue() method is not supported.

Specified by:
containsValue in interface java.util.Map
Parameters:
value - Value to evaluate

entrySet

public java.util.Set entrySet()

The entrySet() method is not supported.

Specified by:
entrySet in interface java.util.Map

equals

public boolean equals(java.lang.Object o)

The equals method checks whether equal MessageResources and Locale are being wrapped.

Specified by:
equals in interface java.util.Map
Parameters:
o - The object to be compared

get

public java.lang.Object get(java.lang.Object key)

Return the message string for the specified key.

Specified by:
get in interface java.util.Map
Parameters:
key - Key for message to return

hashCode

public int hashCode()

The hashCode() method returns values that will be identical if the equals method returns true.

Specified by:
hashCode in interface java.util.Map

isEmpty

public boolean isEmpty()

The isEmpty() method returns false, on the assumption that there is always at least one message available.

Specified by:
isEmpty in interface java.util.Map

keySet

public java.util.Set keySet()

The keySet() method is not supported.

Specified by:
keySet in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

The put() method is not supported.

Specified by:
put in interface java.util.Map
Parameters:
key - Key to store
value - Value to store

putAll

public void putAll(java.util.Map map)

The putAll() method is not supported.

Specified by:
putAll in interface java.util.Map
Parameters:
map - Keys and values to store

remove

public java.lang.Object remove(java.lang.Object key)

The remove() method is not supported.

Specified by:
remove in interface java.util.Map
Parameters:
key - Key to remove

size

public int size()

The size() method is not supported.

Specified by:
size in interface java.util.Map

values

public java.util.Collection values()

The values() method is not supported.

Specified by:
values in interface java.util.Map

getLocale

java.util.Locale getLocale()

Return the Locale we object we are wrapping.


getMessages

org.apache.struts.util.MessageResources getMessages()

Return the MessageResources object we are wrapping.



Copyright ? 2003-2004 - The Apache Software Foundation