001package headfirst.factory.pizzaaf; 002 003public class NYPizzaStore extends PizzaStore { 004 005 protected Pizza createPizza(String item) { 006 Pizza pizza = null; 007 PizzaIngredientFactory ingredientFactory = 008 new NYPizzaIngredientFactory(); 009 010 if (item.equals("cheese")) { 011 012 pizza = new CheesePizza(ingredientFactory); 013 pizza.setName("New York Style Cheese Pizza"); 014 015 } else if (item.equals("veggie")) { 016 017 pizza = new VeggiePizza(ingredientFactory); 018 pizza.setName("New York Style Veggie Pizza"); 019 020 } else if (item.equals("clam")) { 021 022 pizza = new ClamPizza(ingredientFactory); 023 pizza.setName("New York Style Clam Pizza"); 024 025 } else if (item.equals("pepperoni")) { 026 027 pizza = new PepperoniPizza(ingredientFactory); 028 pizza.setName("New York Style Pepperoni Pizza"); 029 030 } 031 return pizza; 032 } 033}