下列代码,使用的设计模式是 interface Shape { void draw(); } class Rectangle implements Shape { @Override public void draw() { System.out.println("Rectangle::draw()"); } } class Square implements Shape { @Override public void draw() { System.out.println("Square::draw()"); } } class ShapeGenerator { public Shape getShape(String shapeType){ if(shapeType == null){ return null; } if(shapeType.equalsIgnoreCase("SQUARE")){ return new Square(); } else if(shapeType.equalsIgnoreCase("RECTANGLE")){ return new Rectangle(); } return null; } }