Frames No Frames

  %method %block %branch %line
net.jaekl.frank.FrankBundle
100%(4/4)
69%(9/13)
67%(4/6)
79%(15/19)

hit count method name method modifiers method signature
1 <clinit> [static] void <clinit>()
3 <init> [private] void <init>(java.util.Locale)
34 get [public] java.lang.String get(java.lang.String)
11 getInst [public, static] net.jaekl.frank.FrankBundle getInst(java.util.Locale)

 1  
 package net.jaekl.frank;
 2  
 
 3  
 import java.util.Locale;
 4  
 import java.util.MissingResourceException;
 5  
 import java.util.ResourceBundle;
 6  
 import java.util.concurrent.ConcurrentHashMap;
 7  
 
 8  
 import net.jaekl.qd.QDBundleFactory;
 9  
 
 10  
 public class FrankBundle {
 11  
 	public static final String DATA_COLLECTED = "data.collected";
 12  
 	public static final String DESTINATION = "destination";
 13  
 	public static final String ERROR_PAGE = "error.page";
 14  
 	public static final String ETA = "eta";
 15  
 	public static final String FRANK = "frank";
 16  
 	public static final String GPS_OFF = "gps.off";
 17  
 	public static final String GPS_READ = "gps.read";
 18  
 	public static final String MINUTES = "m";	// suffix (abbreviated) for minutes
 19  
 	public static final String REMAIN = "remain";
 20  
 	public static final String ROUTE = "route";
 21  
 	public static final String SECONDS = "s";
 22  
 	public static final String UNEXPECTED_ERROR = "unexpected.error";
 23  
 	
 24  
 	final static String BUNDLE_NAME = "frank";
 25  
 	
 26  Block: 1/1 
 	static ConcurrentHashMap<Locale, FrankBundle> m_bundleMap = new ConcurrentHashMap<Locale, FrankBundle>();
 27  
 	
 28  
 	ResourceBundle m_bundle;
 29  
 	
 30  
 	public static FrankBundle getInst(Locale locale) {
 31  Block: 1/1 
 		FrankBundle result = m_bundleMap.get(locale);
 32  
 		if (null == result) {
 33  Block: 1/1 Branch: 1/1 
 			synchronized(FrankBundle.class) {
 34  
 				result = m_bundleMap.get(locale);
 35  
 				if (null == result) {
 36  Block: 1/1 Branch: 1/1 
 					result = new FrankBundle(locale); 
 37  
 				}
 38  Block: 1/1 Branch: 0/1 
 				m_bundleMap.put(locale, result);
 39  
 			}
 40  
 		}
 41  Block: 1/1 Branch: 1/1 
 		return result;
 42  
 	}
 43  
 	
 44  Block: 1/1 
 	private FrankBundle(Locale locale) {
 45  
 		m_bundle = QDBundleFactory.getInst().getBundle(BUNDLE_NAME, locale); 
 46  
 	}
 47  
 	
 48  
 	public String get(String key) {
 49  
 		try {
 50  Block: 1/1 
 			if (null != m_bundle) {
 51  Block: 1/1 Branch: 1/1 
 				return m_bundle.getString(key);
 52  
 			}
 53  
 		}
 54  Block: 0/1 
 		catch (MissingResourceException e) {
 55  
 			// Make it clear that something has gone wrong.
 56  
 			e.printStackTrace();	
 57  
 			// Fall through to the fallback behaviour below
 58  Block: 0/1 Branch: 0/1 
 		}
 59  Block: 0/1 
 		return "[" + key + "]";
 60  
 	}
 61  
 }

Report generated 11/12/14 11:31 PM