org.apache.muse.util.messages
Class MessagesFactory

java.lang.Object
  extended by org.apache.muse.util.messages.MessagesFactory

public class MessagesFactory
extends Object

MessagesFactory is a static factory that allows any object to look up a resource bundle associated with its Java package. If the classpath contains a file named Messages.properties in the same package as the caller, that properties file will be parsed into a Messages collection; this collection can then be used to lookup external messages.

This class loads Messages objects only when they are requested and then caches them for future lookups. It will hold onto the Messages it loads for the lifetime of the application.

Author:
Dan Jemiolo (danj)
See Also:
Messages

Constructor Summary
MessagesFactory()
           
 
Method Summary
static Messages get(Object obj)
          Inspects the object to discover the package name of its Java class and tries to load a properties file in that package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagesFactory

public MessagesFactory()
Method Detail

get

public static Messages get(Object obj)
Inspects the object to discover the package name of its Java class and tries to load a properties file in that package. The file must be named Messages.properties, reside in the same package (but not necessarily the same directory or JAR file), and be in the Java classpath. Once the file is loaded into a Messages, the Messages is cached for future requests.

Parameters:
obj - The object that wishes to get the Messages associated with its Java package.
Returns:
The Messages collection associated with the appropriate Java package.


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.