Coverage Report - com.liquidatom.derbyscore.theme.ThemeFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
ThemeFactory
100%
7/7
N/A
1
 
 1  
 package com.liquidatom.derbyscore.theme;
 2  
 
 3  
 import javax.annotation.concurrent.GuardedBy;
 4  
 import javax.annotation.concurrent.ThreadSafe;
 5  
 
 6  
 /**
 7  
  * The global reference to the {@code Theme} currently being used when rendering the scoreboard 
 8  
  * can be retrieved from this factory.
 9  
  *
 10  
  * @author Russell Francis (russ@metro-six.com)
 11  
  */
 12  
 @ThreadSafe
 13  
 public class ThemeFactory {
 14  
 
 15  1
     final static private ThemeFactory instance = new ThemeFactory();
 16  
 
 17  
     /**
 18  
      * Grab a reference to the ThemeFactory singleton.
 19  
      *
 20  
      * @return The global ThemeFactory instance.
 21  
      */
 22  
     static public ThemeFactory getInstance() {
 23  5
         return instance;
 24  
     }
 25  
 
 26  
     @GuardedBy("this")
 27  
     private Theme current;
 28  
 
 29  
     /**
 30  
      * A private constructor to prevent instantiation.
 31  
      */
 32  1
     private ThemeFactory() {
 33  1
     }
 34  
 
 35  
     /**
 36  
      * Get the current theme used to render the scoreboard.
 37  
      *
 38  
 S     * @return The current theme used to render the scoreboard.
 39  
      */
 40  
     synchronized public Theme getCurrent() {
 41  3
         return current;
 42  
     }
 43  
 
 44  
     /**
 45  
      * Set the current theme used to render the scoreboard.
 46  
      *
 47  
      * @param current The current theme to use to render the scoreboard.
 48  
      */
 49  
     synchronized public void setCurrent(final Theme current) {
 50  2
         this.current = current;
 51  2
     }
 52  
 }