org.teiid.core
Class BundleUtil

java.lang.Object
  extended by org.teiid.core.BundleUtil

public class BundleUtil
extends java.lang.Object


Field Summary
protected  java.lang.String pluginId
           
protected static java.util.ResourceBundle productProps
          The product properties used to override default localized text.
 
Constructor Summary
BundleUtil(java.lang.String pluginId, java.lang.String bundleName, java.util.ResourceBundle bundle)
          Construct an instance of this class by specifying the plugin ID.
 
Method Summary
static BundleUtil getBundleUtil(java.lang.Class<?> clazz)
          Return the BundleUtil for the class.
 java.lang.String getString(java.lang.String key)
          Get the string identified by the given key and localized to the current locale.
 java.lang.String getString(java.lang.String key, java.util.List parameters)
          Get the string identified by the given key and localized to the current locale, and replace placeholders in the localized string with the string form of the parameters.
 java.lang.String getString(java.lang.String key, java.lang.Object... parameters)
          Get the string identified by the given key and localized to the current locale, and replace placeholders in the localized string with the string form of the parameters.
 java.lang.String getStringOrKey(java.lang.String key)
           
 boolean keyExists(java.lang.String key)
          Determines if the given key exists in the resource file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

productProps

protected static java.util.ResourceBundle productProps
The product properties used to override default localized text.

Since:
5.0.2

pluginId

protected final java.lang.String pluginId
Constructor Detail

BundleUtil

public BundleUtil(java.lang.String pluginId,
                  java.lang.String bundleName,
                  java.util.ResourceBundle bundle)
Construct an instance of this class by specifying the plugin ID.

Parameters:
pluginId - the identifier of the plugin for which this utility is being instantiated
bundleName - the name of the resource bundle; used for problem reporting purposes only
bundle - the resource bundle
Method Detail

getBundleUtil

public static BundleUtil getBundleUtil(java.lang.Class<?> clazz)
Return the BundleUtil for the class. The bundle must be in the same package or a parent package of the class.

Parameters:
clazz -
Returns:

getString

public java.lang.String getString(java.lang.String key)
Get the string identified by the given key and localized to the current locale.

Parameters:
key - the key in the resource file
Returns:
the localized String, or "Missing message: " + key + " in: " + this.bundleName if the string could not be found in the current locale, or "No message available" if the key is null.

keyExists

public boolean keyExists(java.lang.String key)
Determines if the given key exists in the resource file.

Parameters:
key - the key in the resource file
Returns:
True if the key exists.
Since:
4.0

getString

public java.lang.String getString(java.lang.String key,
                                  java.util.List parameters)
Get the string identified by the given key and localized to the current locale, and replace placeholders in the localized string with the string form of the parameters.

Parameters:
key - the key in the resource file
parameters - the list of parameters that should replace placeholders in the localized string (e.g., "{0}", "{1}", etc.)
Returns:
the localized String, or "Missing message: " + key + " in: " + this.bundleName if the string could not be found in the current locale, or "No message available" if the key is null.

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object... parameters)
Get the string identified by the given key and localized to the current locale, and replace placeholders in the localized string with the string form of the parameters.

Parameters:
key - the key in the resource file
parameters - the list of parameters that should replace placeholders in the localized string (e.g., "{0}", "{1}", etc.)
Returns:
the localized String, or "Missing message: " + key + " in: " + this.bundleName if the string could not be found in the current locale, or "No message available" if the key is null.

getStringOrKey

public java.lang.String getStringOrKey(java.lang.String key)


Copyright © 2010. All Rights Reserved.