• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RefCapablePropertyResourceBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hsqldb.util..RefCapablePropertyResourceBundle的典型用法代码示例。如果您正苦于以下问题:Java RefCapablePropertyResourceBundle类的具体用法?Java RefCapablePropertyResourceBundle怎么用?Java RefCapablePropertyResourceBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RefCapablePropertyResourceBundle类属于org.hsqldb.util.包,在下文中一共展示了RefCapablePropertyResourceBundle类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRef

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
/**
 * Return a ref to a new or existing RefCapablePropertyResourceBundle,
 * or throw a MissingResourceException.
 */
static private RefCapablePropertyResourceBundle getRef(String baseName,
        ResourceBundle rb, ClassLoader loader) {
    if (!(rb instanceof PropertyResourceBundle))
        throw new MissingResourceException(
                "Found a Resource Bundle, but it is a "
                        + rb.getClass().getName(),
                PropertyResourceBundle.class.getName(), null);
    if (allBundles.containsKey(rb))
        return (RefCapablePropertyResourceBundle) allBundles.get(rb);
    RefCapablePropertyResourceBundle newPRAFP =
            new RefCapablePropertyResourceBundle(baseName,
                    (PropertyResourceBundle) rb, loader);
    allBundles.put(rb, newPRAFP);
    return newPRAFP;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:RefCapablePropertyResourceBundle.java


示例2: RefCapablePropertyResourceBundle

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
private RefCapablePropertyResourceBundle(String baseName,
        PropertyResourceBundle wrappedBundle, ClassLoader loader) {
    this.baseName = baseName;
    this.wrappedBundle = wrappedBundle;
    Locale locale = wrappedBundle.getLocale();
    this.loader = loader;
    language = locale.getLanguage();
    country = locale.getCountry();
    variant = locale.getVariant();
    if (language.length() < 1) language = null;
    if (country.length() < 1) country = null;
    if (variant.length() < 1) variant = null;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:14,代码来源:RefCapablePropertyResourceBundle.java


示例3: getString

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
/**
 * Returns value defined in this RefCapablePropertyResourceBundle's
 * .properties file, unless that value is empty.
 * If the value in the .properties file is empty, then this returns
 * the entire contents of the referenced text file.
 *
 * @see ResourceBundle#getString(String)
 */
public String getString(String key) {
    String value = wrappedBundle.getString(key);
    if (value.length() < 1) {
        value = getStringFromFile(key);
        // For conciseness and sanity, get rid of all \r's so that \n
        // will definitively be our line breaks.
        if (value.indexOf('\r') > -1)
            value = value.replaceAll("\\Q\r\n", "\n")
                    .replaceAll("\\Q\r", "\n");
        if (value.length() > 0 && value.charAt(value.length() - 1) == '\n')
            value = value.substring(0, value.length() - 1);
    }
    return RefCapablePropertyResourceBundle.toNativeLs(value);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:RefCapablePropertyResourceBundle.java


示例4: getRef

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
/**
 * Return a ref to a new or existing RefCapablePropertyResourceBundle,
 * or throw a MissingResourceException.
 */
static private RefCapablePropertyResourceBundle getRef(String baseName,
        ResourceBundle rb, ClassLoader loader) {
    if (!(rb instanceof PropertyResourceBundle))
        throw new MissingResourceException(
                "Found a Resource Bundle, but it is a "
                        + rb.getClass().getName(),
                PropertyResourceBundle.class.getName(), null);
    if (allBundles.containsKey(rb)) return allBundles.get(rb);
    RefCapablePropertyResourceBundle newPRAFP =
            new RefCapablePropertyResourceBundle(baseName,
                    (PropertyResourceBundle) rb, loader);
    allBundles.put(rb, newPRAFP);
    return newPRAFP;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:19,代码来源:RefCapablePropertyResourceBundle.java


示例5: getBundle

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
/**
 * Use exactly like java.util.ResourceBundle.get(String, Locale, ClassLoader).
 *
 * @see ResourceBundle#getBundle(String, Locale, ClassLoader)
 */
public static RefCapablePropertyResourceBundle
        getBundle(String baseName, Locale locale, ClassLoader loader) {
    return getRef(baseName,
            ResourceBundle.getBundle(baseName, locale, loader), loader);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:11,代码来源:RefCapablePropertyResourceBundle.java


示例6: getExpandedString

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
/**
 * Same as getString(), but expands System Variables specified in
 * property values like ${sysvarname}.
 */
public String getExpandedString(String key, int behavior) {
    String s = getString(key);
    Matcher matcher = sysPropVarPattern.matcher(s);
    int previousEnd = 0;
    StringBuffer sb = new StringBuffer();
    String varName, varValue;
    String condlVal;  // Conditional : value
    while (matcher.find()) {
        varName = matcher.group(1);
        condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null);
        varValue = System.getProperty(varName);
        if (condlVal != null) {
            // Replace varValue (the value to be substituted), with
            // the post-:+ portion of the expression.
            varValue = ((varValue == null)
                    ? ""
                    : condlVal.replaceAll("\\Q$" + varName + "\\E\\b",
                            RefCapablePropertyResourceBundle.literalize(
                                    varValue)));
        }
        if (varValue == null) switch (behavior) {
            case THROW_BEHAVIOR:
                throw new RuntimeException(
                        "No Sys Property set for variable '"
                        + varName + "' in property value ("
                        + s + ").");
            case EMPTYSTRING_BEHAVIOR:
                varValue = "";
            case NOOP_BEHAVIOR:
                break;
            default:
                throw new RuntimeException(
                        "Undefined value for behavior: " + behavior);
        }
        sb.append(s.substring(previousEnd, matcher.start())
                    + ((varValue == null) ? matcher.group() : varValue));
        previousEnd = matcher.end();
    }
    return (previousEnd < 1) ? s
                             : (sb.toString() + s.substring(previousEnd));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:46,代码来源:RefCapablePropertyResourceBundle.java


示例7: posSubst

import org.hsqldb.util..RefCapablePropertyResourceBundle; //导入依赖的package包/类
/**
 * Replaces positional substitution patterns of the form %{\d} with
 * corresponding element of the given subs array.
 * Note that %{\d} numbers are 1-based, so we lok for subs[x-1].
 */
public String posSubst(String s, String[] subs, int behavior) {
    Matcher matcher = posPattern.matcher(s);
    int previousEnd = 0;
    StringBuffer sb = new StringBuffer();
    String varValue;
    int varIndex;
    String condlVal;  // Conditional : value
    while (matcher.find()) {
        varIndex = Integer.parseInt(matcher.group(1)) - 1;
        condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null);
        varValue = ((varIndex < subs.length) ? subs[varIndex] : null);
        if (condlVal != null) {
            // Replace varValue (the value to be substituted), with
            // the post-:+ portion of the expression.
            varValue = ((varValue == null)
                    ? ""
                    : condlVal.replaceAll("\\Q%" + (varIndex+1) + "\\E\\b",
                            RefCapablePropertyResourceBundle.literalize(
                                    varValue)));
        }
        // System.err.println("Behavior: " + behavior);
        if (varValue == null) switch (behavior) {
            case THROW_BEHAVIOR:
                throw new RuntimeException(
                        Integer.toString(subs.length)
                        + " positional values given, but property string "
                        + "contains (" + matcher.group() + ").");
            case EMPTYSTRING_BEHAVIOR:
                varValue = "";
            case NOOP_BEHAVIOR:
                break;
            default:
                throw new RuntimeException(
                        "Undefined value for behavior: " + behavior);
        }
        sb.append(s.substring(previousEnd, matcher.start())
                    + ((varValue == null) ? matcher.group() : varValue));
        previousEnd = matcher.end();
    }
    return (previousEnd < 1) ? s
                             : (sb.toString() + s.substring(previousEnd));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:48,代码来源:RefCapablePropertyResourceBundle.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ARBFramebufferObject类代码示例发布时间:2022-05-23
下一篇:
Java SimpleLocator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap