java.util.PropertyResourceBundle

Here are the examples of the java api class java.util.PropertyResourceBundle taken from open source projects.

1. I18NImpl#getString()

Project: openjdk
File: I18NImpl.java
/**
     * Returns the message string with the specified key from the
     * "properties" file in the package containing the class with
     * the specified name.
     */
protected static final String getString(String className, String resource_name, String key) {
    PropertyResourceBundle bundle = null;
    try {
        InputStream stream = Class.forName(className).getResourceAsStream(resource_name);
        bundle = new PropertyResourceBundle(stream);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
    return (String) bundle.handleGetObject(key);
}

2. FluentViewLoader_JavaView_Test#before()

Project: mvvmFX
File: FluentViewLoader_JavaView_Test.java
@Before
public void before() throws Exception {
    resourceBundle = new PropertyResourceBundle(new StringReader(""));
    // This custom dependency injector is used to be able to instantiate inner classes. This way every test case can
    // define
    // its own class for the conditions to test without the need to create a new file.
    MvvmFX.setCustomDependencyInjector( type -> {
        try {
            Constructor<?> constructor = type.getDeclaredConstructors()[0];
            if (constructor.getParameters().length == 0) {
                return constructor.newInstance();
            } else {
                return constructor.newInstance(FluentViewLoader_JavaView_Test.this);
            }
        } catch (Exception e) {
            fail("Test View can't be instantiated. This is a problem with the test code");
            return null;
        }
    });
}

3. I18NImpl#getString()

Project: jdk7u-jdk
File: I18NImpl.java
/**
     * Returns the message string with the specified key from the
     * "properties" file in the package containing the class with
     * the specified name.
     */
protected static final String getString(String className, String resource_name, String key) {
    PropertyResourceBundle bundle = null;
    try {
        InputStream stream = Class.forName(className).getResourceAsStream(resource_name);
        bundle = new PropertyResourceBundle(stream);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
    return (String) bundle.handleGetObject(key);
}

4. I18NImpl#getString()

Project: bioformats
File: I18NImpl.java
/**
     * Returns the message string with the specified key from the
     * "properties" file in the package containing the class with
     * the specified name.
     */
protected static final String getString(String className, String key) {
    PropertyResourceBundle bundle = null;
    try {
        InputStream stream = Class.forName(className).getResourceAsStream("properties");
        bundle = new PropertyResourceBundle(stream);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
    return (String) bundle.handleGetObject(key);
}

5. SafeResourceBundleTest#setUp()

Project: vraptor4
File: SafeResourceBundleTest.java
@Before
public void setUp() throws Exception {
    PropertyResourceBundle delegate = new PropertyResourceBundle(new ByteArrayInputStream("abc=def".getBytes()));
    bundle = new SafeResourceBundle(delegate);
}

6. ResourceBundleInjectorTest#setup()

Project: mvvmFX
File: ResourceBundleInjectorTest.java
@Before
public void setup() throws Exception {
    resourceBundle = new PropertyResourceBundle(new StringReader(""));
}

7. FluentViewLoader_ResourceBundle_Test#setup()

Project: mvvmFX
File: FluentViewLoader_ResourceBundle_Test.java
@Before
public void setup() throws Exception {
    resourceBundle = new PropertyResourceBundle(new StringReader(""));
}

8. FluentViewLoader_FxmlView_Test#setup()

Project: mvvmFX
File: FluentViewLoader_FxmlView_Test.java
@Before
public void setup() throws Exception {
    resourceBundle = new PropertyResourceBundle(new StringReader(""));
}

9. FluentViewLoader_API_Test#setup()

Project: mvvmFX
File: FluentViewLoader_API_Test.java
@Before
public void setup() throws IOException {
    resourceBundle = new PropertyResourceBundle(new StringReader(""));
}

10. ValidationMessages#loadDefaultValidationProperties()

Project: hibernate-validator
File: ValidationMessages.java
private void loadDefaultValidationProperties() throws IOException {
    InputStream in = this.getClass().getResourceAsStream(DEFAULT_PROPERTIES_FILE_NAME);
    PropertyResourceBundle propertyBundle = new PropertyResourceBundle(in);
    setParent(propertyBundle);
}