本文整理汇总了Java中java.util.ListResourceBundle.getString方法的典型用法代码示例。如果您正苦于以下问题:Java ListResourceBundle.getString方法的具体用法?Java ListResourceBundle.getString怎么用?Java ListResourceBundle.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.ListResourceBundle
的用法示例。
在下文中一共展示了ListResourceBundle.getString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMsg
import java.util.ListResourceBundle; //导入方法依赖的package包/类
/**
* Creates a message from the specified key and replacement
* arguments, localized to the given locale.
*
* @param fResourceBundle The resource bundle to use.
* @param msgKey The message key to use.
* @param args The arguments to be used as replacement text
* in the message created.
*
* @return The formatted message string.
*/
public static final String createMsg(ListResourceBundle fResourceBundle,
String msgKey, Object args[]) //throws Exception
{
String fmsg = null;
boolean throwex = false;
String msg = null;
if (msgKey != null)
msg = fResourceBundle.getString(msgKey);
if (msg == null)
{
msg = fResourceBundle.getString(BAD_CODE);
throwex = true;
}
if (args != null)
{
try
{
// Do this to keep format from crying.
// This is better than making a bunch of conditional
// code all over the place.
int n = args.length;
for (int i = 0; i < n; i++)
{
if (null == args[i])
args[i] = "";
}
fmsg = java.text.MessageFormat.format(msg, args);
}
catch (Exception e)
{
fmsg = fResourceBundle.getString(FORMAT_FAILED);
fmsg += " " + msg;
}
}
else
fmsg = msg;
if (throwex)
{
throw new RuntimeException(fmsg);
}
return fmsg;
}
示例2: createXPATHMsg
import java.util.ListResourceBundle; //导入方法依赖的package包/类
/**
* Creates a message from the specified key and replacement arguments,
* localized to the given locale.
*
* @param fResourceBundle The resource bundle to use.
* @param msgKey The message key to use.
* @param args The arguments to be used as replacement text in the message
* created.
*
* @return The formatted message string.
*/
public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
String msgKey, Object args[]) //throws Exception
{
String fmsg = null;
boolean throwex = false;
String msg = null;
if (msgKey != null) {
msg = fResourceBundle.getString(msgKey);
}
if (msg == null) {
msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
throwex = true;
}
if (args != null) {
try {
// Do this to keep format from crying.
// This is better than making a bunch of conditional
// code all over the place.
int n = args.length;
for (int i = 0; i < n; i++) {
if (null == args[i]) {
args[i] = "";
}
}
fmsg = java.text.MessageFormat.format(msg, args);
} catch (Exception e) {
fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
fmsg += " " + msg;
}
} else {
fmsg = msg;
}
if (throwex) {
throw new RuntimeException(fmsg);
}
return fmsg;
}
示例3: createMsg
import java.util.ListResourceBundle; //导入方法依赖的package包/类
/**
* Creates a message from the specified key and replacement
* arguments, localized to the given locale.
*
* @param fResourceBundle The resource bundle to use.
* @param msgKey The message key to use.
* @param args The arguments to be used as replacement text
* in the message created.
*
* @return The formatted message string.
*/
public static final String createMsg(ListResourceBundle fResourceBundle,
String msgKey, Object args[]) //throws Exception
{
String fmsg = null;
boolean throwex = false;
String msg = null;
if (msgKey != null)
msg = fResourceBundle.getString(msgKey);
if (msg == null)
{
msg = fResourceBundle.getString(BAD_CODE);
throwex = true;
}
if (args != null)
{
try
{
// Do this to keep format from crying.
// This is better than making a bunch of conditional
// code all over the place.
int n = args.length;
for (int i = 0; i < n; i++)
{
if (null == args[i])
args[i] = "";
}
fmsg = java.text.MessageFormat.format(msg, args);
}
catch (Exception e)
{
fmsg = fResourceBundle.getString(FORMAT_FAILED);
fmsg += " " + msg;
}
}
else
fmsg = msg;
if (throwex)
{
throw new RuntimeException(fmsg);
}
return fmsg;
}
示例4: createXPATHMsg
import java.util.ListResourceBundle; //导入方法依赖的package包/类
/**
* Creates a message from the specified key and replacement
* arguments, localized to the given locale.
*
* @param fResourceBundle The resource bundle to use.
* @param msgKey The message key to use.
* @param args The arguments to be used as replacement text
* in the message created.
*
* @return The formatted message string.
*/
public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
String msgKey, Object args[]) //throws Exception
{
String fmsg = null;
boolean throwex = false;
String msg = null;
if (msgKey != null)
msg = fResourceBundle.getString(msgKey);
if (msg == null)
{
msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
throwex = true;
}
if (args != null)
{
try
{
// Do this to keep format from crying.
// This is better than making a bunch of conditional
// code all over the place.
int n = args.length;
for (int i = 0; i < n; i++)
{
if (null == args[i])
args[i] = "";
}
fmsg = java.text.MessageFormat.format(msg, args);
}
catch (Exception e)
{
fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
fmsg += " " + msg;
}
}
else
fmsg = msg;
if (throwex)
{
throw new RuntimeException(fmsg);
}
return fmsg;
}