/eifer

Simple way to use Either in domain

Primary LanguageJavaApache License 2.0Apache-2.0

eifer

Simplify your conditions with eifer.

Eifer uses Either class from vavr

Example:

    public Either<ActionError, GameDTO> endGame(EndGameRequestDTO request) {
        return Eifer
                .when(
                        gameCheckers.gameExists(request.getGameId()),
                        gameCheckers.canEndGame(request.getGameId(), request.getUserId())
                ).orAll(
                        gameCheckers.gameExists(request.getGameId()),
                        userCheckers.isAdmin(request.getUserId())

                ).perform(
                        gameService.endGame(request.getGameId())
                );
    }