package cn.datax.learning.design.patterns.creational.factory.simple;

import cn.datax.learning.design.patterns.creational.factory.Circle;
import cn.datax.learning.design.patterns.creational.factory.Rectangle;
import cn.datax.learning.design.patterns.creational.factory.Shape;
import cn.datax.learning.design.patterns.creational.factory.Square;

public class ShapeFactory {

    public Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        } else if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        } else if (shapeType.equalsIgnoreCase("SQUARE")) {
            return new Square();
        }
        return null;
    }
}
