package de.ivu.elect.business.lokalisierung.control;

import java.util.Enumeration;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;

import javax.annotation.Nonnull;

public abstract class AbstractMessages extends ResourceBundle {

  @Override
  protected Object handleGetObject(@Nonnull String key) {
    if (LokalisierungResourceBundle.INSTANCE.containsKey(key)) {
      Object result = LokalisierungResourceBundle.INSTANCE.getObjectNonNull(key, false);
      if (result == null) {
        return ""; // MissingResourceException vermeiden
      }
      return result;
    }

    return "";// MissingResourceException vermeiden
  }

  @Nonnull
  @Override
  public Enumeration<String> getKeys() {
    return LokalisierungResourceBundle.INSTANCE.getKeys();
  }

  @Override
  protected Set<String> handleKeySet() {
    return LokalisierungResourceBundle.INSTANCE.handleKeySet();
  }

  @Override
  public Locale getLocale() {
    return LokalisierungResourceBundle.INSTANCE.getLocale();
  }
}
