
package de.ivu.elect.jee.faces.messagehelper;

import java.util.ResourceBundle;

import javax.enterprise.context.ApplicationScoped;


import static java.util.Objects.isNull;

@ApplicationScoped
public abstract class AbstractResourceBundleResolver {

  private transient ResourceBundle resourceBundle;

  public AbstractResourceBundleResolver() {
    super();
  }

  public ResourceBundle getResourceBundle() {
    if (isNull(resourceBundle)) {
      resourceBundle = createResourceBundle();
    }

    return resourceBundle;
  }

  protected abstract ResourceBundle createResourceBundle();
}
