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

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

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
  public Locale getLocale() {
    return LokalisierungResourceBundle.INSTANCE.getLocale();
  }
}
