Coverage Report - liquibase.util.ui.UIFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
UIFactory
0%
0/14
0%
0/2
2
 
 1  
 package liquibase.util.ui;
 2  
 
 3  
 import java.lang.reflect.Constructor;
 4  
 
 5  0
 public class UIFactory {
 6  
     private static final String UI_IMPL_CLASSNAME = "liquibase.util.ui.SwingUIFacade";
 7  0
     private static UIFactory instance = new UIFactory();
 8  
 
 9  
     private UIFacade facade; // = new SwingUIFacade();
 10  
 
 11  
     public static UIFactory getInstance() {
 12  0
         return instance;
 13  
     }
 14  
 
 15  
     @SuppressWarnings("unchecked")
 16  
     public UIFacade getFacade() {
 17  0
         if (facade == null) {
 18  0
             ClassLoader cl = UIFacade.class.getClassLoader();
 19  
             try {
 20  0
                 Class<UIFacade> swingUIClazz = (Class<UIFacade>) cl.loadClass(UI_IMPL_CLASSNAME);
 21  0
                 Constructor<UIFacade> con = swingUIClazz.getConstructor(new Class[0]);
 22  0
                 facade = con.newInstance(new Object[0]);
 23  
 
 24  0
             } catch (Exception e) {
 25  
                 // Should never happen as class exists
 26  0
                 throw new RuntimeException(e);
 27  0
             }
 28  
         }
 29  
 
 30  0
         return facade;
 31  
     }
 32  
 
 33  
     public void setFacade(UIFacade facade) {
 34  0
         this.facade = facade;
 35  0
     }
 36  
 }