org.sandev.basics.util
Class PropUtils

java.lang.Object
  extended byorg.sandev.basics.util.PropUtils

public class PropUtils
extends java.lang.Object

A utility for value lookup in localized property files. The files are cached after initial read and accessed via the language and country values in the locale information.


Field Summary
protected static java.util.Map propmap
          Our caching data structure.
 
Constructor Summary
PropUtils()
           
 
Method Summary
static java.lang.String getLocalizedProperty(java.lang.String propfilespec, java.util.Locale locale, java.lang.String rsrcKey, java.lang.String defaultVal)
          Return the property if found, or the default value if not.
static java.util.Properties loadPropfile(java.io.File propfile, java.lang.String mapkey)
          Load the Properties from the file specified and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propmap

protected static java.util.Map propmap
Our caching data structure.

Constructor Detail

PropUtils

public PropUtils()
Method Detail

getLocalizedProperty

public static java.lang.String getLocalizedProperty(java.lang.String propfilespec,
                                                    java.util.Locale locale,
                                                    java.lang.String rsrcKey,
                                                    java.lang.String defaultVal)
Return the property if found, or the default value if not. The property file spec is the base file specification following the java.util.ResourceBundle conventions.


loadPropfile

public static java.util.Properties loadPropfile(java.io.File propfile,
                                                java.lang.String mapkey)
                                         throws java.io.IOException
Load the Properties from the file specified and return it. We cache it using the mapkey so we don't have to load it again.

Throws:
java.io.IOException