MCPcopy Create free account
hub / github.com/Seogeurim/CS-study / ProductFactory

Class ProductFactory

contents/design-pattern/code/FactoryJava/FactoryTest.java:32–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32class ProductFactory {
33 public static Product getProduct(String className) {
34 Product p = null;
35 switch (className) {
36 case "Pencil": p = new Pencil(); break;
37 case "Note": p = new Note(); break;
38 }
39 return p;
40 }
41}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected