001package factory.shape2; 002public class ShapeFactory { 003 private ShapeFactory() {} 004 static public Shape newInstance(String selector) { 005 if ("Circle".equals(selector)) return new Circle(); 006 if ("Square".equals(selector)) return new Square(); 007 throw new IllegalArgumentException(); 008 } 009}