Skip to content

Commit 75ed1b1

Browse files
committed
Review fixes
1 parent 49ca630 commit 75ed1b1

File tree

10 files changed

+70
-11
lines changed

10 files changed

+70
-11
lines changed

hexagonal/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@
3232
<artifactId>java-design-patterns</artifactId>
3333
<version>1.12.0-SNAPSHOT</version>
3434
</parent>
35-
<groupId>com.iluwatar.hexagonal</groupId>
3635
<artifactId>hexagonal</artifactId>
37-
<version>1.0-SNAPSHOT</version>
38-
<name>hexagonal</name>
39-
<url>http://maven.apache.org</url>
4036
<dependencies>
4137
<dependency>
4238
<groupId>junit</groupId>

hexagonal/src/main/java/com/iluwatar/hexagonal/administration/LotteryAdministration.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@
3535
*/
3636
public interface LotteryAdministration {
3737

38+
/**
39+
* Get all the lottery tickets submitted for lottery
40+
*/
3841
Map<LotteryTicketId, LotteryTicket> getAllSubmittedTickets();
42+
43+
/**
44+
* Draw lottery numbers
45+
*/
3946
LotteryNumbers performLottery();
47+
48+
/**
49+
* Begin new lottery round
50+
*/
4051
void resetLottery();
4152

4253
}

hexagonal/src/main/java/com/iluwatar/hexagonal/administration/LotteryAdministrationImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@
4747
public class LotteryAdministrationImpl implements LotteryAdministration {
4848

4949
private final LotteryTicketRepository repository;
50-
5150
private final LotteryService service = new LotteryServiceImpl();
52-
5351
private final LotteryNotifications notifications = new LotteryNotificationsImpl();
54-
5552
private final WireTransfers bank = new WireTransfersImpl();
56-
5753
public LotteryAdministrationImpl() {
5854
repository = new LotteryTicketInMemoryRepository();
5955
}

hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,19 @@
2929
*/
3030
public interface WireTransfers {
3131

32+
/**
33+
* Set amount of funds for bank account
34+
*/
3235
void setFunds(String bankAccount, int amount);
36+
37+
/**
38+
* Get amount of funds for bank account
39+
*/
3340
int getFunds(String bankAccount);
41+
42+
/**
43+
* Transfer funds from one bank account to another
44+
*/
3445
boolean transferFunds(int amount, String sourceBackAccount, String destinationBankAccount);
3546

3647
}

hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,24 @@
3535
*/
3636
public interface LotteryTicketRepository {
3737

38+
/**
39+
* Find lottery ticket by id
40+
*/
3841
Optional<LotteryTicket> findById(LotteryTicketId id);
42+
43+
/**
44+
* Save lottery ticket
45+
*/
3946
Optional<LotteryTicketId> save(LotteryTicket ticket);
47+
48+
/**
49+
* Get all lottery tickets
50+
*/
4051
Map<LotteryTicketId, LotteryTicket> findAll();
52+
53+
/**
54+
* Delete all lottery tickets
55+
*/
4156
void deleteAll();
4257

4358
}

hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public class LotteryTicketCheckResult {
3232
public enum CheckResult { WIN_PRIZE, NO_PRIZE, TICKET_NOT_SUBMITTED };
3333

3434
private final CheckResult checkResult;
35-
3635
private final int prizeAmount;
3736

3837
/**

hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketId.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
import java.util.UUID;
2626

27+
/**
28+
* Lottery ticked id
29+
*/
2730
public class LotteryTicketId {
2831

2932
private final UUID id;

hexagonal/src/main/java/com/iluwatar/hexagonal/notifications/LotteryNotifications.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,30 @@
3030
*
3131
*/
3232
public interface LotteryNotifications {
33-
33+
34+
/**
35+
* Notify lottery ticket was submitted
36+
*/
3437
void notifyTicketSubmitted(PlayerDetails details);
38+
39+
/**
40+
* Notify there was an error submitting lottery ticket
41+
*/
3542
void notifyTicketSubmitError(PlayerDetails details);
43+
44+
/**
45+
* Notify lottery ticket did not win
46+
*/
3647
void notifyNoWin(PlayerDetails details);
48+
49+
/**
50+
* Notify that prize has been paid
51+
*/
3752
void notifyPrize(PlayerDetails details, int prizeAmount);
53+
54+
/**
55+
* Notify that there was an error paying the prize
56+
*/
3857
void notifyPrizeError(PlayerDetails details, int prizeAmount);
3958

4059
}

hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@
3636
*/
3737
public interface LotteryService {
3838

39+
/**
40+
* Submit lottery ticket to participate in the lottery
41+
*/
3942
Optional<LotteryTicketId> submitTicket(LotteryTicket ticket);
4043

44+
/**
45+
* Check if lottery ticket has won
46+
*/
4147
LotteryTicketCheckResult checkTicketForPrize(LotteryTicketId id, LotteryNumbers winningNumbers);
4248
}

hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryServiceImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public class LotteryServiceImpl implements LotteryService {
4949
private final WireTransfers bank = new WireTransfersImpl();
5050

5151
private final LotteryNotifications notifications = new LotteryNotificationsImpl();
52-
52+
53+
/**
54+
* Constructor
55+
*/
5356
public LotteryServiceImpl() {
5457
repository = new LotteryTicketInMemoryRepository();
5558
}

0 commit comments

Comments
 (0)