java.util.ResourceBundle#Control ( )源码实例Demo

下面列出了java.util.ResourceBundle#Control ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: Bug8167143.java
/**
 * Check that candidate locales list retrieved for zh__Hant and for zh__Hans
 * do not have first candidate locale as zh_TW_Hant and zh_CN_Hans
 * respectively.
 */
private static void testCandidateLocales() {
    ResourceBundle.Control Control = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
    Locale zh_Hant = Locale.forLanguageTag("zh-Hant");
    Locale zh_Hans = Locale.forLanguageTag("zh-Hans");
    List<Locale> zhHantCandidateLocs = Control.getCandidateLocales("", zh_Hant);
    List<Locale> zhHansCandidateLocs = Control.getCandidateLocales("", zh_Hans);
    if (!zhHantCandidateLocs.equals(ZH_HANT_CANDLOCS)) {
        reportDifference(zhHantCandidateLocs, ZH_HANT_CANDLOCS, "zh_Hant");

    }
    if (!zhHansCandidateLocs.equals(ZH_HANS_CANDLOCS)) {
        reportDifference(zhHansCandidateLocs, ZH_HANS_CANDLOCS, "zh_Hans");

    }
}
 
源代码2 项目: TencentKona-8   文件: UserControlProvider.java
public ResourceBundle.Control getControl(String baseName) {
    System.out.println(getClass().getName()+".getControl called for " + baseName);

    // Throws a NPE if baseName is null.
    if (baseName.startsWith("com.foo.Xml")) {
        System.out.println("\treturns " + XMLCONTROL);
        return XMLCONTROL;
    }
    System.out.println("\treturns null");
    return null;
}
 
@Test
public void testNewControl() {
    SortedMap<String, Charset> charsetsSortedMap = Charset.availableCharsets();
    for (String encoding : charsetsSortedMap.keySet()) {
        ResourceBundle.Control control = PropertyResourceBundleControl.newControl(encoding);
        Assert.assertNotNull(control);
    }
}
 
源代码4 项目: openjdk-8-source   文件: UserControlProvider.java
public ResourceBundle.Control getControl(String baseName) {
    System.out.println(getClass().getName()+".getControl called for " + baseName);

    // Throws a NPE if baseName is null.
    if (baseName.startsWith("com.foo.Xml")) {
        System.out.println("\treturns " + XMLCONTROL);
        return XMLCONTROL;
    }
    System.out.println("\treturns null");
    return null;
}
 
源代码5 项目: hottub   文件: UserControlProvider.java
public ResourceBundle.Control getControl(String baseName) {
    System.out.println(getClass().getName()+".getControl called for " + baseName);

    // Throws a NPE if baseName is null.
    if (baseName.startsWith("com.foo.Xml")) {
        System.out.println("\treturns " + XMLCONTROL);
        return XMLCONTROL;
    }
    System.out.println("\treturns null");
    return null;
}
 
public ResourceBundle.Control getControl(String baseName) {
    System.out.println(getClass().getName()+".getControl called for " + baseName);

    // Throws a NPE if baseName is null.
    if (baseName.startsWith("com.foo.Xml")) {
        System.out.println("\treturns " + XMLCONTROL);
        return XMLCONTROL;
    }
    System.out.println("\treturns null");
    return null;
}
 
源代码7 项目: jdk8u_jdk   文件: UserControlProvider.java
public ResourceBundle.Control getControl(String baseName) {
    System.out.println(getClass().getName()+".getControl called for " + baseName);

    // Throws a NPE if baseName is null.
    if (baseName.startsWith("com.foo.Xml")) {
        System.out.println("\treturns " + XMLCONTROL);
        return XMLCONTROL;
    }
    System.out.println("\treturns null");
    return null;
}
 
源代码8 项目: jdk8u-jdk   文件: UserControlProvider.java
public ResourceBundle.Control getControl(String baseName) {
    System.out.println(getClass().getName()+".getControl called for " + baseName);

    // Throws a NPE if baseName is null.
    if (baseName.startsWith("com.foo.Xml")) {
        System.out.println("\treturns " + XMLCONTROL);
        return XMLCONTROL;
    }
    System.out.println("\treturns null");
    return null;
}
 
源代码9 项目: AndrOBD   文件: UTF8Bundle.java
public UTF8Bundle(ResourceBundle.Control control)
{
    ctrl = control;
}
 
源代码10 项目: j2objc   文件: ResourceBundleTest.java
public void test_getCandidateLocales() throws Exception {
    ResourceBundle.Control c = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
    assertEquals("[en_US, en, ]", c.getCandidateLocales("base", Locale.US).toString());
    assertEquals("[de_CH, de, ]", c.getCandidateLocales("base", new Locale("de", "CH")).toString());
}
 
源代码11 项目: Bytecoder   文件: TResourceBundle.java
public static ResourceBundle.Control getControl(final List aList) {
    return (ResourceBundle.Control) (Object) INSTANCE;
}
 
源代码12 项目: Bytecoder   文件: TResourceBundle.java
public static ResourceBundle.Control getNoFallbackControl(final List aList) {
    return (ResourceBundle.Control) (Object) INSTANCE;
}
 
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
源代码14 项目: openjdk-8   文件: ResourceBundleControlProvider.java
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
源代码15 项目: hottub   文件: ResourceBundleControlProvider.java
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
源代码16 项目: jdk8u-jdk   文件: ResourceBundleControlProvider.java
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
源代码17 项目: jdk8u60   文件: ResourceBundleControlProvider.java
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
源代码19 项目: jdk8u-jdk   文件: ResourceBundleControlProvider.java
/**
 * Returns a {@code ResourceBundle.Control} instance that is used
 * to handle resource bundle loading for the given {@code
 * baseName}. This method must return {@code null} if the given
 * {@code baseName} isn't handled by this provider.
 *
 * @param baseName the base name of the resource bundle
 * @return a {@code ResourceBundle.Control} instance,
 *         or {@code null} if the given {@code baseName} is not
 *         applicable to this provider.
 * @throws NullPointerException if {@code baseName} is {@code null}
 */
public ResourceBundle.Control getControl(String baseName);
 
/**
 * {@link ResourceBundle#getBundle(String, Locale, ClassLoader)} with specified encoding
 *
 * @param baseName
 *         the base name of the resource bundle, a fully qualified class name
 * @param locale
 *         the locale for which a resource bundle is desired
 * @param classLoader
 *         the class loader from which to load the resource bundle
 * @param encoding
 *         the control which gives information for the resource bundle loading process
 * @return
 * @throws NullPointerException
 *         if <code>baseName</code>, <code>locale</code>, or <code>loader</code> is <code>null</code>
 * @throws MissingResourceException
 *         if no resource bundle for the specified base name can be found
 * @throws IllegalArgumentException
 *         if the given <code>control</code> doesn't perform properly (e.g., <code>control.getCandidateLocales</code>
 *         returns null.) Note that validation of <code>control</code> is performed as needed.
 */
public static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader classLoader, String encoding) {
    ResourceBundle.Control control = PropertyResourceBundleControl.newControl(encoding);
    return ResourceBundle.getBundle(baseName, locale, classLoader, control);
}