Factory in Java when concrete objects take different constructor parameters
You have two options: 1) Abstract Factory: RectangularShape extends Shape RoundShape extends Shape and RectangularShapeFactory and RoundShapeFactory 2) Builder (see also Item 2 in Effective Java) public Shape { private final int x; private final int y; private final double radius; private Shape(Builder builder) { x = builder.x; y = builder.y; radius = builder.radius; } … Read more