com.sas.edir.util
Class RBBase

java.lang.Object
  |
  +--com.sas.edir.util.RBBase

public abstract class RBBase
extends java.lang.Object

This class is used to manage locale specific strings.

Every package should contain a class, RB, that extends this class and a resource bundle, Resources.properties.

Version:
1.0
Author:
SAS

Field Summary
protected static java.lang.String CORRUPT_MSG_FILE
           
protected static java.lang.String MISSING_MSG_FILE
           
 
Constructor Summary
protected RBBase()
          Protected constructor because RB is accessed through static methods.
 
Method Summary
static java.lang.String formatString(RBBase rb, java.util.Locale locale, java.lang.String key, java.lang.Object[] args)
          Returns a formatted string resource from the default resource bundle.
protected  java.lang.String getBundleName()
          Returns the resource bundle name for this object.
protected  java.lang.String getfileName()
          Returns the filename for this object.
protected  java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
          Returns the resource bundle for this object.
static java.util.ResourceBundle getResources(RBBase rb, java.util.Locale locale)
          Returns the default resource bundle for this package.
static java.lang.String getString(RBBase rb, java.util.Locale locale, java.lang.String key)
          Returns a string resource from the default resource bundle.
protected  void setResourceBundle(java.util.Locale locale, java.util.ResourceBundle bundle)
          Sets the resource bundle for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MISSING_MSG_FILE

protected static final java.lang.String MISSING_MSG_FILE

CORRUPT_MSG_FILE

protected static final java.lang.String CORRUPT_MSG_FILE
Constructor Detail

RBBase

protected RBBase()
Protected constructor because RB is accessed through static methods.
Method Detail

getString

public static java.lang.String getString(RBBase rb,
                                         java.util.Locale locale,
                                         java.lang.String key)
Returns a string resource from the default resource bundle.

Parameters:
rb - The resource bundle to fetch the resource from.
locale - The locale to use.
key - A resource key.
Returns:
A string resource obtained from the key.

formatString

public static java.lang.String formatString(RBBase rb,
                                            java.util.Locale locale,
                                            java.lang.String key,
                                            java.lang.Object[] args)
Returns a formatted string resource from the default resource bundle.

The string resource is formatted by MessageFormat.format using args as the format arguments.

Parameters:
rb - The resource bundle to fetch the resource from.
locale - The locale to use.
key - A resource key.
args - Arguments used to format the string stored in key.
Returns:
A string resource obtained from the key.

getResources

public static java.util.ResourceBundle getResources(RBBase rb,
                                                    java.util.Locale locale)
Returns the default resource bundle for this package.

The bundle is created as a PropertyResourceBundle from package.Resources, which is defined in the properties file, package.Resources.properties (or in a locale-specific version such as Resources_de_DE.properties).

Parameters:
rb - The resource bundle to fetch the resource from.
locale - The locale to use.
Returns:
The default resource bundle.

getResourceBundle

protected java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
Returns the resource bundle for this object.

Parameters:
locale - The locale to use.
Returns:
The resource bundle for this object.

setResourceBundle

protected void setResourceBundle(java.util.Locale locale,
                                 java.util.ResourceBundle bundle)
Sets the resource bundle for this object.

Parameters:
locale - The locale to use.
The - new resource bundle for this object.

getBundleName

protected java.lang.String getBundleName()
Returns the resource bundle name for this object.

Returns:
The resource bundle name for this object.

getfileName

protected java.lang.String getfileName()
Returns the filename for this object.

Returns:
The filename for this object.