Coalevo Logo

net.coalevo.foundation.util
Class DummyMessages

java.lang.Object
  extended by net.coalevo.foundation.util.DummyMessages
All Implemented Interfaces:
Messages

public class DummyMessages
extends java.lang.Object
implements Messages

Implements Messages without actual message resolving.

This is an utility class that can be instantiated and used for debugging, or when the MessageResourceService is not available.

Author:
Dieter Wimberger

Constructor Summary
DummyMessages()
           
 
Method Summary
 java.lang.String get(java.util.Locale l, java.lang.String key)
          Returns the message with the given key and if available Locale.
 java.lang.String get(java.util.Locale l, java.lang.String key, MessageAttributes attr)
          Returns the message with the given key, attributes and Locale.
 java.lang.String get(java.util.Locale l, java.lang.String key, java.lang.String name, java.lang.String val)
          Convenience method that returns the message with the given key and the specified attribute in the default Locale.
 java.lang.String get(java.util.Locale l, java.lang.String key, java.lang.String name1, java.lang.String val1, java.lang.String name2, java.lang.String val2)
          Convenience method that returns the message with the given key and the specified attributes in the default Locale.
 java.lang.String get(java.lang.String key)
          Returns the message with the given key and in the default Locale.
 java.lang.String get(java.lang.String key, MessageAttributes attr)
          Returns the message with the given key, attributes the default Locale.
 java.lang.String get(java.lang.String key, java.lang.String name, java.lang.String val)
          Convenience method that returns the message with the given key and the specified attribute in the default Locale.
 java.lang.String get(java.lang.String key, java.lang.String name1, java.lang.String val1, java.lang.String name2, java.lang.String val2)
          Convenience method that returns the message with the given key and the specified attributes in the default Locale.
 MessageAttributes leaseAttributes()
          Returns a leased MessageAttributes instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyMessages

public DummyMessages()
Method Detail

get

public java.lang.String get(java.lang.String key)
Description copied from interface: Messages
Returns the message with the given key and in the default Locale.

Specified by:
get in interface Messages
Parameters:
key - the message key.
Returns:
the message string.

get

public java.lang.String get(java.lang.String key,
                            MessageAttributes attr)
Description copied from interface: Messages
Returns the message with the given key, attributes the default Locale.

Attributes should be leased from this instance using Messages.leaseAttributes(). The will be automatically recycled after a call to this method, so your application should not use the reference any further.

Specified by:
get in interface Messages
Parameters:
key - the message key.
attr - the attributes for the message.
Returns:
the formatted message string.
See Also:
Messages.leaseAttributes()

get

public java.lang.String get(java.lang.String key,
                            java.lang.String name,
                            java.lang.String val)
Description copied from interface: Messages
Convenience method that returns the message with the given key and the specified attribute in the default Locale.

Specified by:
get in interface Messages
Parameters:
key - the message key.
name - an attribute name.
val - attribute value.
Returns:
the formatted message string.

get

public java.lang.String get(java.lang.String key,
                            java.lang.String name1,
                            java.lang.String val1,
                            java.lang.String name2,
                            java.lang.String val2)
Description copied from interface: Messages
Convenience method that returns the message with the given key and the specified attributes in the default Locale.

Specified by:
get in interface Messages
Parameters:
key - the message key.
name1 - an attribute name.
val1 - attribute value.
name2 - an attribute name.
val2 - attribute value.
Returns:
the formatted message string.

get

public java.lang.String get(java.util.Locale l,
                            java.lang.String key)
Description copied from interface: Messages
Returns the message with the given key and if available Locale.

Specified by:
get in interface Messages
Parameters:
l - the locale.
key - the message key.
Returns:
the message string.

get

public java.lang.String get(java.util.Locale l,
                            java.lang.String key,
                            MessageAttributes attr)
Description copied from interface: Messages
Returns the message with the given key, attributes and Locale.

Attributes should be leased from this instance using Messages.leaseAttributes(). The will be automatically recycled after a call to this method, so your application should not use the reference any further.

Specified by:
get in interface Messages
Parameters:
l - the locale.
key - the message key.
attr - the attributes for the message.
Returns:
the formatted message string.
See Also:
Messages.leaseAttributes()

get

public java.lang.String get(java.util.Locale l,
                            java.lang.String key,
                            java.lang.String name,
                            java.lang.String val)
Description copied from interface: Messages
Convenience method that returns the message with the given key and the specified attribute in the default Locale.

Specified by:
get in interface Messages
Parameters:
l - the locale.
key - the message key.
name - an attribute name.
val - attribute value.
Returns:
the formatted message string.

get

public java.lang.String get(java.util.Locale l,
                            java.lang.String key,
                            java.lang.String name1,
                            java.lang.String val1,
                            java.lang.String name2,
                            java.lang.String val2)
Description copied from interface: Messages
Convenience method that returns the message with the given key and the specified attributes in the default Locale.

Specified by:
get in interface Messages
Parameters:
l - the locale.
key - the message key.
name1 - an attribute name.
val1 - attribute value.
name2 - an attribute name.
val2 - attribute value.
Returns:
the formatted message string.

leaseAttributes

public MessageAttributes leaseAttributes()
Description copied from interface: Messages
Returns a leased MessageAttributes instance. This instance should be used immediately and passed to Messages.get(Locale,String,MessageAttributes), which will recycle the instance returning it to the originating pool.

Specified by:
leaseAttributes in interface Messages
Returns:
a MessageAttributes instance.

Coalevo Logo

(c) 2004-2009 VFI (http://www.vfi.or.at)