it.imolinfo.jbi4ejb.jbi
Class Messages

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

public final class Messages
extends java.lang.Object

Class dedicated to the internationalization of application messages.

Author:
Marco Cimatti

Method Summary
static Messages getMessages(java.lang.Class clazz)
          Factory method to create a Messages object from a Class.
static Messages getMessages(java.lang.Class clazz, java.util.Locale locale)
          Factory method to create a Messages object from a Class and a Locale.
 java.lang.String getString(java.lang.String key, java.lang.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(java.lang.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(java.lang.Class clazz,
                                   java.util.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 java.lang.String getString(java.lang.String key,
                                  java.lang.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 © 2007-2008 Imola Informatica. All Rights Reserved.