org.apache.struts.faces.util
Class MessagesMap

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

public class MessagesMap
extends Object
implements 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/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MessagesMap(MessageResources messages, 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(Object key)
          Return true if there is a message for the specified key.
 boolean containsValue(Object value)
          The containsValue() method is not supported.
 Set entrySet()
          The entrySet() method is not supported.
 boolean equals(Object o)
          The equals method checks whether equal MessageResources and Locale are being wrapped.
 Object get(Object key)
          Return the message string for the specified key.
 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.
 Set keySet()
          The keySet() method is not supported.
 Object put(Object key, Object value)
          The put() method is not supported.
 void putAll(Map map)
          The putAll() method is not supported.
 Object remove(Object key)
          The remove() method is not supported.
 int size()
          The size() method is not supported.
 Collection values()
          The values() method is not supported.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagesMap

public MessagesMap(MessageResources messages,
                   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:
NullPointerException - if messages is null
Method Detail

clear

public void clear()

The clear() method is not supported.

Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)

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

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

containsValue

public boolean containsValue(Object value)

The containsValue() method is not supported.

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

entrySet

public Set entrySet()

The entrySet() method is not supported.

Specified by:
entrySet in interface Map

equals

public boolean equals(Object o)

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

Specified by:
equals in interface Map
Overrides:
equals in class Object
Parameters:
o - The object to be compared

get

public Object get(Object key)

Return the message string for the specified key.

Specified by:
get in interface 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 Map
Overrides:
hashCode in class Object

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 Map

keySet

public Set keySet()

The keySet() method is not supported.

Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)

The put() method is not supported.

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

putAll

public void putAll(Map map)

The putAll() method is not supported.

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

remove

public Object remove(Object key)

The remove() method is not supported.

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

size

public int size()

The size() method is not supported.

Specified by:
size in interface Map

values

public Collection values()

The values() method is not supported.

Specified by:
values in interface Map


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.