首页 > 代码库 > 测试客户端

测试客户端

package headfirst.factory.pizzas.pizzafactory;

import headfirst.factory.pizzas.pizza.CheesePizza;
import headfirst.factory.pizzas.pizza.ClamPizza;
import headfirst.factory.pizzas.pizza.PepperoniPizza;
import headfirst.factory.pizzas.pizza.Pizza;
import headfirst.factory.pizzas.pizza.VeggiePizza;

public class SimplePizzaFactory {

    public Pizza createPizza(String type) {
        Pizza pizza = null;

        if (type.equals("cheese")) {
            pizza = new CheesePizza();
        } else if (type.equals("pepperoni")) {
            pizza = new PepperoniPizza();
        } else if (type.equals("clam")) {
            pizza = new ClamPizza();
        } else if (type.equals("veggie")) {
            pizza = new VeggiePizza();
        }
        return pizza;
    }
}

技术分享

技术分享

内容样式!!!!!!!!!

测试客户端