FileDocCategorySizeDatePackage
BundleReader.javaAPI DocGlassfish v2 API3979Thu May 17 17:55:50 BST 2007com.sun.enterprise.tools.common.validation.util

BundleReader

public class BundleReader extends Object
BundleReader is a Class to read properties from the bundle. getValue() method can be used to read the properties from the bundle file(Bundle.properties). Default bundle file used is { @link Constants }.BUNDLE_FILE. Bundle file to use can be set by using setBundle() method.
author
Rajeshwar Patil
version
%I%, %G% NOT THREAD SAFE: mutable 'resourceBundle'

Fields Summary
private static ResourceBundle
resourceBundle
A resource bundle of this reader.
Constructors Summary
public BundleReader()
Creates a new instance of BundleReader

    
Methods Summary
private static voidIGNORE_EXCEPTION(java.lang.Exception e)

        // ignore
    
public static java.lang.StringgetValue(java.lang.String key)
Gets the value of the the given key from the bundle

param
key the key of which, the value needs to be fetched from the bundle.

        if(resourceBundle == null)
            return key;
        try {
            return resourceBundle.getString(key);
        } catch (MissingResourceException missingResourceException) {
            IGNORE_EXCEPTION(missingResourceException);
            return key;
        }
    
public static voidsetBundle(java.lang.String bundleFile)
sets the given bundle file as the file to use by this object.

        try {
            resourceBundle = ResourceBundle.getBundle(bundleFile);
        } catch (Exception ex) {
            IGNORE_EXCEPTION(ex);
        }