17 lines
509 B
Java
17 lines
509 B
Java
package abstractfactory;
|
|
|
|
// Entry point: the ONLY place that knows the theme
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
|
|
// Production: read theme from config or OS preference
|
|
String theme = System.getProperty("app.theme", "light");
|
|
UIFactory factory = "dark".equals(theme) ? new DarkThemeFactory() : new LightThemeFactory();
|
|
|
|
Application app = new Application(factory);
|
|
app.buildUI();
|
|
app.render();
|
|
app.simulateSubmit();
|
|
}
|
|
}
|