当前位置: 首页>>代码示例>>Java>>正文


Java ListResourceBundle.getString方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:XMLMessages.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:XPATHMessages.java

示例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;
 }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:63,代码来源:XMLMessages.java

示例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;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:63,代码来源:XPATHMessages.java


注:本文中的java.util.ListResourceBundle.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。