@@ -0,0 +1,1001 @@
+package com.eblly.factoryPattern;%0A%0A/**%0A * FactoryPattern:%E6%A0%B9%E6%93%9A%E8%BC%B8%E5%85%A5%E5%B0%8D%E6%87%89%E7%9A%84%E5%9C%96%E5%BD%A2%E5%90%8D%E7%A8%B1%E7%94%9F%E6%88%90%E5%B0%8D%E6%87%89%E7%9A%84%E5%9C%96%E5%BD%A2.%0A * %E7%B1%BB%E4%BC%BCAbstract Facroty Pattern%0A *%0A * @author eblly%0A * @version 1.0%0A * @date Aug 12, 2015%0A **/%0Ainterface Shape %7B%0A    void paint();%0A%7D%0A%0A/**%0A * %E7%9F%A9%E5%BD%A2%0A */%0Aclass Rectangle implements Shape %7B%0A    public void paint() %7B%0A        System.out.println(%22%E6%88%91%E6%98%AF%E7%9F%A9%E5%BD%A2!%22);%0A    %7D%0A%7D%0A%0A/**%0A * %E5%9C%93%E5%BD%A2%0A */%0Aclass Circle implements Shape %7B%0A    public void paint() %7B%0A        System.out.println(%22%E6%88%91%E6%98%AF%E5%9C%93%E5%BD%A2!%22);%0A    %7D%0A%7D%0A%0A/**%0A * ShapeFactory%0A */%0Aclass ShapeFactory %7B%0A    public Shape createShape(String name) %7B%0A        if (name.equalsIgnoreCase(%22circle%22)) %7B%0A            return new Circle();%0A        %7D else if (name.equalsIgnoreCase(%22rectangle%22)) %7B%0A            return new Rectangle();%0A        %7D%0A        return null;%0A    %7D%0A%7D%0A%0Apublic class Main %7B%0A    public static void main(String%5B%5D args) %7B%0A        String shapeName = %22rectangle%22;%0A        ShapeFactory shapeFactory = new ShapeFactory();%0A        Shape shape = shapeFactory.createShape(shapeName);%0A        shape.paint();%0A    %7D%0A%7D%0A

add factory pattern