In JDK there are many places where Abstract Factory design pattern
is used. Some of these are as follows:
javax.xml.xpath.XPathFactory.newInstance()
javax.xml.parsers.DocumentBuilderFactory.newInstance()
javax.xml.transform.TransformerFactory.newInstance()
xxxxxxxxxx
public class TestDesignPatterns {
public static void main(String[] args) {
testAbstractFactory();
}
private static void testAbstractFactory() {
Computer pc = com.journaldev.design.abstractfactory.ComputerFactory.getComputer(new PCFactory("2 GB","500 GB","2.4 GHz"));
Computer server = com.journaldev.design.abstractfactory.ComputerFactory.getComputer(new ServerFactory("16 GB","1 TB","2.9 GHz"));
System.out.println("AbstractFactory PC Config::"+pc);
System.out.println("AbstractFactory Server Config::"+server);
}
}
https://www.digitalocean.com/community/tutorials/abstract-factory-design-pattern-in-java