Factory patterns in java. Design Patterns in Java