Search in sources :

Example 1 with WireTransfers

use of com.iluwatar.hexagonal.banking.WireTransfers in project java-design-patterns by iluwatar.

the class ConsoleLottery method main.

/**
 * Program entry point
 */
public static void main(String[] args) {
    MongoConnectionPropertiesLoader.load();
    Injector injector = Guice.createInjector(new LotteryModule());
    LotteryService service = injector.getInstance(LotteryService.class);
    WireTransfers bank = injector.getInstance(WireTransfers.class);
    try (final Scanner scanner = new Scanner(System.in)) {
        boolean exit = false;
        while (!exit) {
            printMainMenu();
            String cmd = readString(scanner);
            if ("1".equals(cmd)) {
                queryLotteryAccountFunds(bank, scanner);
            } else if ("2".equals(cmd)) {
                addFundsToLotteryAccount(bank, scanner);
            } else if ("3".equals(cmd)) {
                submitTicket(service, scanner);
            } else if ("4".equals(cmd)) {
                checkTicket(service, scanner);
            } else if ("5".equals(cmd)) {
                exit = true;
            } else {
                LOGGER.info("Unknown command");
            }
        }
    }
}
Also used : Scanner(java.util.Scanner) Injector(com.google.inject.Injector) WireTransfers(com.iluwatar.hexagonal.banking.WireTransfers) LotteryModule(com.iluwatar.hexagonal.module.LotteryModule) LotteryService(com.iluwatar.hexagonal.domain.LotteryService)

Aggregations

Injector (com.google.inject.Injector)1 WireTransfers (com.iluwatar.hexagonal.banking.WireTransfers)1 LotteryService (com.iluwatar.hexagonal.domain.LotteryService)1 LotteryModule (com.iluwatar.hexagonal.module.LotteryModule)1 Scanner (java.util.Scanner)1