it.imolinfo.jbi4corba.jbi
Class Messages

java.lang.Object
  extended by it.imolinfo.jbi4corba.jbi.Messages

public final class Messages
extends Object

Class dedicated to the internationalization of application messages.

Author:
Marco Cimatti

Method Summary
static Messages getMessages(Class clazz)
          Factory method to create a Messages object from a Class.
static Messages getMessages(Class clazz, Locale locale)
          Factory method to create a Messages object from a Class and a Locale.
 String getString(String key, Object... args)
          Retrieves a localized String which may contains parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessages

public static Messages getMessages(Class clazz)
Factory method to create a Messages object from a Class.

Parameters:
clazz - the class used to find the resource bundle. Must not be null.
Returns:
a Messages object related to clazz, never null. The messages bundle used is related to the default locale.

getMessages

public static Messages getMessages(Class clazz,
                                   Locale locale)
Factory method to create a Messages object from a Class and a Locale.

Parameters:
clazz - the class used to find the resource bundle. Must not be null.
locale - the Locale to find the correct resource bundle. If null, the default locale will be used.
Returns:
a Messages object related to clazz and locale, never null.

getString

public String getString(String key,
                        Object... args)
Retrieves a localized String which may contains parameters. This method applies a MessageFormat to the value with the arguments provided.

Parameters:
key - the resource key to retrieve the (localized) message.
args - the optional MessageFormat arguments.
Returns:
the localized messaged related to the key key after the substitution of its parameters with values args.


Copyright © 2005-2010 Imola Informatica. All Rights Reserved.