Coverage Report - org.crosswire.jsword.internationalisation.LocaleProviderManager
 
Classes in this File Line Coverage Branch Coverage Complexity
LocaleProviderManager
0%
0/7
N/A
1
 
 1  
 /**
 2  
  * Distribution License:
 3  
  * JSword is free software; you can redistribute it and/or modify it under
 4  
  * the terms of the GNU Lesser General Public License, version 2.1 or later
 5  
  * as published by the Free Software Foundation. This program is distributed
 6  
  * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 7  
  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 8  
  * See the GNU Lesser General Public License for more details.
 9  
  *
 10  
  * The License is available on the internet at:
 11  
  *      http://www.gnu.org/copyleft/lgpl.html
 12  
  * or by writing to:
 13  
  *      Free Software Foundation, Inc.
 14  
  *      59 Temple Place - Suite 330
 15  
  *      Boston, MA 02111-1307, USA
 16  
  *
 17  
  * © CrossWire Bible Society, 2013 - 2016
 18  
  *
 19  
  */
 20  
 package org.crosswire.jsword.internationalisation;
 21  
 
 22  
 import java.util.Locale;
 23  
 
 24  
 /**
 25  
  * A factory for creating LocaleProvider objects, to support all the static instances of where JSword needs access to the the Locale.
 26  
  * <p>
 27  
  * It is expected that the LocaleProvider will only be set once, as a result, no effort is made to make this thread-safe as this should happen on
 28  
  * start up of the application. A default locale provider is given which simply returns the default locale. See {@link DefaultLocaleProvider} for more details.
 29  
  * </p>
 30  
  * 
 31  
  * @see gnu.lgpl.License The GNU Lesser General Public License for details.
 32  
  * @author Chris Burrell
 33  
  */
 34  
 public final class LocaleProviderManager {
 35  
     /**
 36  
      * Prevent public access. Instantiates a new locale provider factory.
 37  
      */
 38  0
     private LocaleProviderManager() {
 39  
         //No OP
 40  0
     }
 41  
 
 42  
     /**
 43  
      * Gets the locale provider.
 44  
      *
 45  
      * @return the locale provider
 46  
      */
 47  
     public static LocaleProvider getLocaleProvider() {
 48  0
         return localeProvider;
 49  
     }
 50  
 
 51  
     /**
 52  
      * Gets the locale to be used by the JSword library
 53  
      *
 54  
      * @return the locale
 55  
      */
 56  
     public static Locale getLocale() {
 57  0
         return localeProvider.getUserLocale();
 58  
     }
 59  
 
 60  
     /**
 61  
      * Allow third-party applications to.
 62  
      *
 63  
      * @param provider the new locale provider
 64  
      */
 65  
     public static void setLocaleProvider(LocaleProvider provider) {
 66  0
         localeProvider = provider;
 67  0
     }
 68  
 
 69  0
     private static LocaleProvider localeProvider = new DefaultLocaleProvider();
 70  
 }