1 // Copyright (C) 2004, 2014 Christian Jaekl
3 // Central spot from which to access ResourceBundles.
4 // This made more sense with earlier versions of Java, where the specification did not
5 // guarantee that ResourceBundles would be cached. Java 7 and later cache by default,
6 // but it still seems prudent to centralize accesses to resources here so that we have
7 // control in case we want to implement our own cache, or override certain behaviours.
9 // Note that we rely on the JVM's caching, to avoid unnecessary overhead.
10 // See http://java2go.blogspot.ca/2010/03/dont-be-smart-never-implement-resource.html
14 import java.util.Locale;
15 import java.util.ResourceBundle;
17 public class QDBundleFactory {
18 static volatile QDBundleFactory m_inst; // singleton instance
20 private QDBundleFactory() {
24 public static QDBundleFactory getInst() {
25 QDBundleFactory result = m_inst;
27 synchronized(QDBundleFactory.class) {
29 m_inst = new QDBundleFactory();
37 public ResourceBundle getBundle(String baseName, Locale locale) {
38 return ResourceBundle.getBundle(baseName, locale);