The Abstract Factory provides an interface for creating families of related or dependent objects without the need to specify their concrete classes.
意思是笼统工厂提供一个接口,这个接口可以创立一系列相关依赖的对象,并且不用指定他需要创立的哪一个具体的类。总而言之,就是一个笼统接口可以获取好几种不同类别的对象。
最重要的一步是
In the example above, the ShapeFactory can be used to create objects based on the String shapeType. So, we do not need to specify the concrete class, but only need to pass the type string. This pattern uses inheritance to define the factories that create objects.
本文GitHub代码地址
推荐看这篇文章