Choosing a movement strategy based on the type of chess piece PawnMovement ... KingMovement are of type Movement. This is implementation of strategy pattern. Basing on actual value of PieceType I want to choose proper strategy. How to avoid long if/else statements or switch?

    PieceType pieceType;
    if(this.board.getPieceAt(from) != null) {
        pieceType = this.board.getPieceAt(from).getType();
    } else {
        throw new InvalidMoveException();
    }

    if (pieceType == PieceType.PAWN) {
        contextMovement.setContext(new PawnMovement());
    } else if (pieceType == PieceType.ROOK) {
        contextMovement.setContext(new RookMovement());
    } else if (pieceType == PieceType.KNIGHT) {
        contextMovement.setContext(new KnightMovement());
    } else if (pieceType == PieceType.BISHOP) {
        contextMovement.setContext(new BishopMovement());
    } else if (pieceType == PieceType.QUEEN) {
        contextMovement.setContext(new QueenMovement());
    } else if (pieceType == PieceType.KING) {
        contextMovement.setContext(new KingMovement());
    }
    return contextMovement.executeMovement(from, to, board);
The complexity of approach is too high, it can be reduced to the following:

PieceType pieceType = getPieceType();
contextMovement.setContext(pieceType.getMovement());
return contextMovement.executeMovement(from, to, board);


The PieceType enum (probably call it Piece?) can be extended with:

public enum Piece {

  PAWN() {
    @Override
    public Movement getMovement() { 
      return new PawnMovement();
    }
  }, ... // other elements;

  public abstract Movement getMovement();

}