Frames No Frames

  %method %block %branch %line
net.jaekl.qd.QDBundleFactory
100%(3/3)
88%(7/8)
75%(3/4)
100%(11/11)

hit count method name method modifiers method signature
1 <init> [private] void <init>()
3 getBundle [public] java.util.ResourceBundle getBundle(java.lang.String,java.util.Locale)
5 getInst [public, static] net.jaekl.qd.QDBundleFactory getInst()

 1  
 // Copyright (C) 2004, 2014 Christian Jaekl
 2  
 
 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.
 8  
 // 
 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
 11  
 
 12  
 package net.jaekl.qd;
 13  
 
 14  
 import java.util.Locale;
 15  
 import java.util.ResourceBundle;
 16  
 
 17  
 public class QDBundleFactory {
 18  
 	static volatile QDBundleFactory m_inst;	// singleton instance
 19  
 	
 20  Block: 1/1 
 	private QDBundleFactory() {
 21  
 		// no-op
 22  
 	}
 23  
 	
 24  
 	public static QDBundleFactory getInst() {
 25  Block: 1/1 
 		QDBundleFactory result = m_inst;
 26  
 		if (null == result) {
 27  Block: 1/1 Branch: 1/1 
 			synchronized(QDBundleFactory.class) {
 28  
 				if (null == m_inst) {
 29  Block: 1/1 Branch: 1/1 
 					m_inst = new QDBundleFactory();
 30  
 				}
 31  Block: 1/1 Branch: 0/1 
 				result = m_inst;
 32  
 			}
 33  
 		}
 34  Block: 1/1 Branch: 1/1 
 		return result;
 35  
 	}
 36  
 	
 37  
 	public ResourceBundle getBundle(String baseName, Locale locale) {
 38  Block: 1/1 
 		return ResourceBundle.getBundle(baseName, locale);
 39  
 	}
 40  
 }

Report generated 11/12/14 11:31 PM