Methods Summary |
---|
public java.lang.String | get(java.lang.String indexString)Get a String from the caller's package's LocalStrings.properties
try
{
return getBundle().getString(indexString);
}
catch (Exception e)
{
// it is not an error to have no key...
return indexString;
}
|
public java.lang.String | get(java.lang.String indexString, java.lang.Object objects)Get and format a String from the caller's package's LocalStrings.properties
indexString = get(indexString);
try
{
MessageFormat mf = new MessageFormat(indexString);
return mf.format(objects);
}
catch(Exception e)
{
return indexString;
}
|
public boolean | getBoolean(java.lang.String indexString, boolean defaultValue)Get a boolean from the caller's package's LocalStrings.properties
try
{
return Boolean.valueOf(getBundle().getString(indexString));
}
catch (Exception e)
{
// it is not an error to have no key...
return defaultValue;
}
|
private java.util.ResourceBundle | getBundle()
return bundle;
|
public int | getInt(java.lang.String indexString, int defaultValue)Get an integer from the caller's package's LocalStrings.properties
try
{
String s = getBundle().getString(indexString);
return Integer.parseInt(s);
}
catch (Exception e)
{
// it is not an error to have no key...
return defaultValue;
}
|
public java.lang.String | getString(java.lang.String indexString, java.lang.String defaultValue)Get a String from the caller's package's LocalStrings.properties
try
{
return getBundle().getString(indexString);
}
catch (Exception e)
{
// it is not an error to have no key...
return defaultValue;
}
|
private void | setBundle(java.lang.Class clazz)
setBundle(clazz.getName());
|
private void | setBundle(java.lang.String className)
try
{
String props;
// handle the default package...
if(className.indexOf('.") < 0)
props = propsFilename;
else
props = className.substring(0, className.lastIndexOf('.")) + '." + propsFilename;
bundle = ResourceBundle.getBundle(props);
}
catch(Exception e)
{
bundle = null;
}
|
private void | setBundle()
// go through the stack, top to bottom. The item that is below the LAST
// method that is in the util framework is where the logfile is.
// note that there may be more than one method from util in the stack
// because they may be calling us indirectly from LoggerHelper. Also
// note that this class won't work from any class in the util hierarchy itself.
try
{
StackTraceElement[] items = Thread.currentThread().getStackTrace();
int lastMeOnStack = -1;
for(int i = 0; i < items.length; i++)
{
StackTraceElement item = items[i];
if(item.getClassName().startsWith(thisPackage))
lastMeOnStack = i;
}
String className = items[lastMeOnStack + 1].getClassName();
setBundle(className);
}
catch(Exception e)
{
bundle = null;
}
|