Is there anything wrong with my Factory class?
- by Alex
class PieceFactory {
@SuppressWarnings("rawtypes")
public Piece createPiece(String pieceType) throws Throwable{
Class pieceClass = Class.forName(pieceType);
Piece piece = (Piece) pieceClass.newInstance();
return piece;
}
}
I'm not all used to handling exceptions yet therefore I'm just throwing…