org.ow2.util.i18n
Class I18n

java.lang.Object
  extended by org.ow2.util.i18n.I18n

public final class I18n
extends Object

This class defines the way for getting message with ResourceBundle for different language. Inspired from http://java.sun.com/docs/books/tutorial/i18n/

Author:
Florent Benoit

Method Summary
static I18n getInstance(Class<?> c)
          Gets the instance for a given class.
static I18n getInstance(Class<?> c, ClassLoader cl)
          Gets the instance for a given class.
static I18n getInstance(String packageName)
          Gets the instance for a given package.
static I18n getInstance(String packageName, ClassLoader cl)
          Gets the instance for a given package.
 String getMessage(String key, Object... objs)
          Gets the formatted string with the given arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static I18n getInstance(Class<?> c)
Gets the instance for a given class.

Parameters:
c - the class for which we want a bundle.
Returns:
I18n object.

getInstance

public static I18n getInstance(Class<?> c,
                               ClassLoader cl)
Gets the instance for a given class.

Parameters:
c - the class for which we want a bundle.
cl - the classloader used to load bundle.
Returns:
I18n object.

getInstance

public static I18n getInstance(String packageName)
Gets the instance for a given package.

Parameters:
packageName - the package for which we want a bundle.
Returns:
I18n object.

getInstance

public static I18n getInstance(String packageName,
                               ClassLoader cl)
Gets the instance for a given package.

Parameters:
packageName - the package for which we want a bundle.
cl - the classloader used to load bundle.
Returns:
I18n object.

getMessage

public String getMessage(String key,
                         Object... objs)
Gets the formatted string with the given arguments.

Parameters:
key - the keystring on which to apply arguments.
objs - list of argument for the formatter.
Returns:
the formatted string.


Copyright © 2007-2012 OW2 Consortium. All Rights Reserved.