com.l2fprod.common.util
Class ResourceManager

java.lang.Object
  extended by com.l2fprod.common.util.ResourceManager

public class ResourceManager
extends java.lang.Object

Manages application resources.


Method Summary
static ResourceManager all(java.lang.Class clazz)
           
static ResourceManager common()
          Gets the default ResourceManager.
static ResourceManager get(java.lang.Class clazz)
          Gets the ResourceManager associated with clazz.
static ResourceManager get(java.lang.String bundleName)
          Gets the ResourceManager with the given name.
 char getChar(java.lang.String key)
          Gets the first character of the String associated with key.
 java.lang.String getString(java.lang.String key)
          Gets the String associated with key after having resolved any nested keys (resolve(String)).
 java.lang.String getString(java.lang.String key, java.lang.Object[] args)
          Gets the String associated with key after having resolved any nested keys (resolve(String)) and applied a formatter using the given args.
static java.lang.String resolve(java.lang.String rbAndProperty)
          Resolves any references to a resource bundle contained in rbAndProperty.
static java.lang.String resolve(java.lang.String rbAndProperty, java.lang.Object[] args)
          Same as resolve(String) but once the value as been resolved, a MessageFormatter is applied with the given args.
static ResourceManager ui()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static ResourceManager get(java.lang.Class clazz)
Gets the ResourceManager associated with clazz. It looks for a ResourceBundle named against the class name plus the string "RB". For example, for the com.mypackage.Main, the ResourceBundle com.mypackage.MainRB will be looked up.

Parameters:
clazz -
Returns:
the ResourceManager associated with the class

get

public static ResourceManager get(java.lang.String bundleName)
Gets the ResourceManager with the given name.

Parameters:
bundleName -
Returns:
the ResourceManager with the given name.

all

public static ResourceManager all(java.lang.Class clazz)
Parameters:
clazz -
Returns:
the "AllRB" in the class package

common

public static ResourceManager common()
Gets the default ResourceManager. This is equivalent to all(ResourceManager.class). It returns the ResourceManager named "AllRB" located in the same package ResourceManager class (i.e com.l2fprod.common.util.AllRB).

Returns:
the default ResourceManager

ui

public static ResourceManager ui()
Returns:
the default ResourceManager for ui specific resources.

resolve

public static java.lang.String resolve(java.lang.String rbAndProperty)
Resolves any references to a resource bundle contained in rbAndProperty. To reference a resource bundle inside a property use ${com.package.FileRB:key}, this will look for key in the ResourceBundle com.package.FileRB.

Parameters:
rbAndProperty -
Returns:
the resolved resource or rbAndProperty if no resource was found

resolve

public static java.lang.String resolve(java.lang.String rbAndProperty,
                                       java.lang.Object[] args)
Same as resolve(String) but once the value as been resolved, a MessageFormatter is applied with the given args.

Parameters:
rbAndProperty -
args -
Returns:
the value for the resource parametrized by args

getString

public java.lang.String getString(java.lang.String key)
Gets the String associated with key after having resolved any nested keys (resolve(String)).

Parameters:
key - the key to lookup
Returns:
the String associated with key

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object[] args)
Gets the String associated with key after having resolved any nested keys (resolve(String)) and applied a formatter using the given args.

Parameters:
key - the key to lookup
args - the arguments to pass to the formatter
Returns:
the String associated with key

getChar

public char getChar(java.lang.String key)
Gets the first character of the String associated with key.

Parameters:
key - the key to lookup
Returns:
the first character of the String associated with key.