11121314151617181920
protected Pizza createPizza(String type) { switch (type) { case "cheese": return new NYStyleCheesePizza(); case "clam": return new NYStyleClamPizza(); default: throw new IllegalArgumentException("Sorry, we don't bake " + type + " pizzas here"); } }