Code example for ResourceBundle

Methods: containsKeygetString

0
    public OptionValuesException(Class<? extends Options<?>> optionsInterface, String pattern, Object... arguments) {
        super(MessageFormat.format(pattern, arguments));
        ResourceBundle rb = new I18NResourceBundle(optionsInterface);
        String key = this.getClass().getName();
        try { 
            if(rb.containsKey(key)) {
                this.localizedMessage = MessageFormat.format(rb.getString(key), arguments);
            } else { 
                this.localizedMessage = this.getMessage();
            } 
        } catch (MissingResourceException e) {
            System.err.println("Key " + key + " not found.");
            this.localizedMessage = this.getMessage();
        } 
    } 
     
    public OptionValuesException(Throwable cause, Class<? extends Options<?>> optionsInterface, String pattern, Object... arguments) {
        super(MessageFormat.format(pattern, arguments), cause);
        ResourceBundle rb = new I18NResourceBundle(optionsInterface);
        String key = this.getClass().getName();
Connect your IDE to all the code out there  Get Codota for Java