com.acsinet_solutions.util.text
Class PropertyMessageFactory

java.lang.Object
  extended by com.acsinet_solutions.util.text.PropertyMessageFactory
All Implemented Interfaces:
MessageFactory

public class PropertyMessageFactory
extends java.lang.Object
implements MessageFactory

A ResourceBundle-based message factory implementation. Multiple ResourceBundles may be combined into a single map to provide combination of keys from different sources. That means that key naming is important to avoid collitions.

Author:
Santiago Arriaga

Constructor Summary
PropertyMessageFactory(java.lang.String path)
          Public constructor
 
Method Summary
 java.lang.String getMessage(java.lang.String key, java.lang.Object... args)
          Get a message associated with the given key and optional arguments.
 void loadMessages(java.util.ResourceBundle bundle)
          Load the messages from the given bundle name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyMessageFactory

public PropertyMessageFactory(java.lang.String path)
Public constructor

Parameters:
path - A not-null valid path to the resource bundle
Method Detail

loadMessages

public final void loadMessages(java.util.ResourceBundle bundle)
Load the messages from the given bundle name. IMPORTANT! No key MUST be defined twice, so name conventions in the bundle files are STRONGLY suggested


getMessage

public final java.lang.String getMessage(java.lang.String key,
                                         java.lang.Object... args)
Description copied from interface: MessageFactory
Get a message associated with the given key and optional arguments.

Specified by:
getMessage in interface MessageFactory