Add all 23 GoF design pattern implementations
This commit is contained in:
16
01-creational/abstract-factory/Main.java
Normal file
16
01-creational/abstract-factory/Main.java
Normal file
@@ -0,0 +1,16 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user