mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-23 18:25:24 +00:00
docs: Content SEO updates (#2990)
* update yaml frontmatter format * update abstract document * update abstract factory * use the new pattern template * acyclic visitor seo * adapter seo * ambassador seo * acl seo * aaa seo * async method invocation seo * balking seo * bridge seo * builder seo * business delegate and bytecode seo * caching seo * callback seo * chain seo * update headings * circuit breaker seo * client session + collecting parameter seo * collection pipeline seo * combinator SEO * command seo * cqrs seo * commander seo * component seo * composite seo * composite entity seo * composite view seo * context object seo * converter seo * crtp seo * currying seo * dao seo * data bus seo * data locality seo * data mapper seo * dto seo * decorator seo * delegation seo * di seo * dirty flag seo * domain model seo * double buffer seo * double checked locking seo * double dispatch seo * dynamic proxy seo * event aggregator seo * event-based asynchronous seo * eda seo * event queue seo * event sourcing seo * execute around seo * extension objects seo * facade seo * factory seo * factory kit seo * factory method seo * fanout/fanin seo * feature toggle seo * filterer seo * fluent interface seo * flux seo * flyweight seo * front controller seo * function composition seo * game loop seo * gateway seo * guarded suspension seo * half-sync/half-async seo * health check seo * hexagonal seo * identity map seo * intercepting filter seo * interpreter seo * iterator seo * layers seo * lazy loading seo * leader election seo * leader/followers seo * lockable object seo * rename and add seo for marker interface * master-worker seo * mediator seo * memento seo * metadata mapping seo * microservice aggregator seo * api gw seo * microservices log aggregration seo * mvc seo * mvi seo * mvp seo * mvvm seo * monad seo * monitor seo * monostate seo * multiton seo * mute idiom seo * naked objects & notification seo * null object seo * object mother seo * object pool seo * observer seo * optimistic locking seo * page controller seo * page object seo * parameter object seo * partial response seo * pipeline seo * poison pill seo * presentation model seo * private class data seo * producer-consumer seo * promise seo * property seo * prototype seo * proxy seo * queue-based load leveling seo * reactor seo * registry seo * repository seo * RAII seo * retry seo * role object seo * saga seo * separated interface seo * serialized entity seo * serialized lob seo * servant seo * server session seo * service layer seo * service locator seo * service to worker seo * sharding seo * single table inheritance seo * singleton seo * spatial partition seo * special case seo * specification seo * state seo * step builder seo * strangler seo * strategy seo * subclass sandbox seo * table module seo * template method seo * throttling seo * tolerant reader seo * trampoline seo * transaction script seo * twin seo * type object seo * unit of work seo * update method seo * value object seo * version number seo * virtual proxy seo * visitor seo * seo enhancements * seo improvements * SEO enhancements * SEO improvements * SEO additions * SEO improvements * more SEO improvements * rename hexagonal + SEO improvements * SEO improvements * more SEO stuff * SEO improvements * SEO optimizations * SEO enhancements * enchance SEO * improve SEO * SEO improvements * update headers
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 145 KiB |
@@ -0,0 +1,280 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<class-diagram version="1.1.10" icons="true" automaticImage="PNG" always-add-relationships="false"
|
||||
generalizations="true" realizations="true" associations="true" dependencies="false" nesting-relationships="true"
|
||||
router="FAN">
|
||||
<class id="1" language="java" name="com.iluwatar.hexagonal.eventlog.StdOutEventLog" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/notifications/StdOutNotifications.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="167" width="235" x="731" y="122"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="2" language="java" name="com.iluwatar.hexagonal.banking.InMemoryBank" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/InMemoryBank.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="149" width="217" x="1006" y="122"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="3" language="java" name="com.iluwatar.hexagonal.domain.LotterySystem" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotterySystemImpl.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="167" width="421" x="1263" y="122"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="4" language="java" name="com.iluwatar.hexagonal.domain.LotteryTicket" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicket.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="167" width="278" x="1568" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="5" language="java" name="com.iluwatar.hexagonal.database.InMemoryTicketRepository" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/database/InMemoryTicketRepository.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="149" width="265" x="1724" y="122"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="6" language="java" name="com.iluwatar.hexagonal.banking.WireTransfers" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="113" width="217" x="1006" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="7" language="java" name="com.iluwatar.hexagonal.domain.LotteryService" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleService.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="113" width="421" x="2029" y="122"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="8" language="java" name="com.iluwatar.hexagonal.database.LotteryTicketRepository" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="131" width="265" x="1263" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="9" language="java" name="com.iluwatar.hexagonal.domain.LotterySystem" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotterySystem.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="149" width="421" x="1886" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="10" language="java" name="com.iluwatar.hexagonal.domain.LotteryNumbers" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="275" width="209" x="1568" y="554"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="11" language="java" name="com.iluwatar.hexagonal.domain.LotteryAdministration"
|
||||
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/LotteryAdministration.java"
|
||||
binary="false" corner="BOTTOM_RIGHT">
|
||||
<position height="113" width="320" x="2808" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="12" language="java" name="com.iluwatar.hexagonal.domain.LotteryNumbers.RandomNumberGenerator"
|
||||
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="113" width="189" x="1568" y="869"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="13" language="java" name="com.iluwatar.hexagonal.domain.LotteryAdministration" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="131" width="320" x="2490" y="122"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="14" language="java" name="com.iluwatar.hexagonal.domain.PlayerDetails" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/PlayerDetails.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="239" width="222" x="1019" y="554"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="15" language="java" name="com.iluwatar.hexagonal.domain.LotteryService" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryService.java" binary="false"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="95" width="421" x="2347" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="16" language="java" name="com.iluwatar.hexagonal.App" project="hexagonal"
|
||||
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/App.java" binary="false" corner="BOTTOM_RIGHT">
|
||||
<position height="131" width="221" x="470" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="17" language="java" name="com.iluwatar.hexagonal.eventlog.LotteryEventLog"
|
||||
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/notifications/LotteryNotifications.java"
|
||||
binary="false" corner="BOTTOM_RIGHT">
|
||||
<position height="149" width="235" x="731" y="347"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<association id="18">
|
||||
<end type="SOURCE" refId="16" navigable="false">
|
||||
<attribute id="19" name="PLAYERS"/>
|
||||
<multiplicity id="20" minimum="0" maximum="2147483647"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="14" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="21">
|
||||
<end type="SOURCE" refId="3" navigable="false">
|
||||
<attribute id="22" name="wireTransfers"/>
|
||||
<multiplicity id="23" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="6" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="24">
|
||||
<end type="SOURCE" refId="5"/>
|
||||
<end type="TARGET" refId="8"/>
|
||||
</realization>
|
||||
<nesting id="25">
|
||||
<end type="SOURCE" refId="10"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</nesting>
|
||||
<association id="26">
|
||||
<end type="SOURCE" refId="5" navigable="false">
|
||||
<attribute id="27" name="tickets"/>
|
||||
<multiplicity id="28" minimum="0" maximum="2147483647"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="4" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="29">
|
||||
<end type="SOURCE" refId="1"/>
|
||||
<end type="TARGET" refId="17"/>
|
||||
</realization>
|
||||
<realization id="30">
|
||||
<end type="SOURCE" refId="3"/>
|
||||
<end type="TARGET" refId="9"/>
|
||||
</realization>
|
||||
<realization id="31">
|
||||
<end type="SOURCE" refId="7"/>
|
||||
<end type="TARGET" refId="15"/>
|
||||
</realization>
|
||||
<association id="32">
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="33" name="lotteryNumbers"/>
|
||||
<multiplicity id="34" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="10" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="35">
|
||||
<end type="SOURCE" refId="13"/>
|
||||
<end type="TARGET" refId="11"/>
|
||||
</realization>
|
||||
<association id="36">
|
||||
<end type="SOURCE" refId="13" navigable="false">
|
||||
<attribute id="37" name="lotterySystem"/>
|
||||
<multiplicity id="38" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="9" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="39">
|
||||
<end type="SOURCE" refId="7" navigable="false">
|
||||
<attribute id="40" name="lotterySystem"/>
|
||||
<multiplicity id="41" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="9" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="42">
|
||||
<end type="SOURCE" refId="3" navigable="false">
|
||||
<attribute id="43" name="repository"/>
|
||||
<multiplicity id="44" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="8" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="45">
|
||||
<end type="SOURCE" refId="2"/>
|
||||
<end type="TARGET" refId="6"/>
|
||||
</realization>
|
||||
<association id="46">
|
||||
<end type="SOURCE" refId="3" navigable="false">
|
||||
<attribute id="47" name="notifications"/>
|
||||
<multiplicity id="48" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="17" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="49">
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="50" name="playerDetails"/>
|
||||
<multiplicity id="51" minimum="0" maximum="1"/>
|
||||
</end>
|
||||
<end type="TARGET" refId="14" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</classifier-display>
|
||||
<association-display labels="true" multiplicity="true"/>
|
||||
</class-diagram>
|
||||
@@ -0,0 +1,305 @@
|
||||
@startuml
|
||||
package com.iluwatar.hexagonal.sampledata {
|
||||
class SampleData {
|
||||
- PLAYERS : List<PlayerDetails> {static}
|
||||
- RANDOM : Random {static}
|
||||
+ SampleData()
|
||||
- getRandomPlayerDetails() : PlayerDetails {static}
|
||||
+ submitTickets(lotteryService : LotteryService, numTickets : int) {static}
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.service {
|
||||
class ConsoleLottery {
|
||||
- LOGGER : Logger {static}
|
||||
+ ConsoleLottery()
|
||||
+ main(args : String[]) {static}
|
||||
- printMainMenu() {static}
|
||||
- readString(scanner : Scanner) : String {static}
|
||||
}
|
||||
interface LotteryConsoleService {
|
||||
+ addFundsToLotteryAccount(WireTransfers, Scanner) {abstract}
|
||||
+ checkTicket(LotteryService, Scanner) {abstract}
|
||||
+ queryLotteryAccountFunds(WireTransfers, Scanner) {abstract}
|
||||
+ submitTicket(LotteryService, Scanner) {abstract}
|
||||
}
|
||||
class LotteryConsoleServiceImpl {
|
||||
- logger : Logger
|
||||
+ LotteryConsoleServiceImpl(logger : Logger)
|
||||
+ addFundsToLotteryAccount(bank : WireTransfers, scanner : Scanner)
|
||||
+ checkTicket(service : LotteryService, scanner : Scanner)
|
||||
+ queryLotteryAccountFunds(bank : WireTransfers, scanner : Scanner)
|
||||
- readString(scanner : Scanner) : String
|
||||
+ submitTicket(service : LotteryService, scanner : Scanner)
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.mongo {
|
||||
class MongoConnectionPropertiesLoader {
|
||||
- DEFAULT_HOST : String {static}
|
||||
- DEFAULT_PORT : int {static}
|
||||
+ MongoConnectionPropertiesLoader()
|
||||
+ load() {static}
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.domain {
|
||||
class LotteryAdministration {
|
||||
- notifications : LotteryEventLog
|
||||
- repository : LotteryTicketRepository
|
||||
- wireTransfers : WireTransfers
|
||||
+ LotteryAdministration(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers)
|
||||
+ getAllSubmittedTickets() : Map<LotteryTicketId, LotteryTicket>
|
||||
+ performLottery() : LotteryNumbers
|
||||
+ resetLottery()
|
||||
}
|
||||
class LotteryConstants {
|
||||
+ PLAYER_MAX_BALANCE : int {static}
|
||||
+ PRIZE_AMOUNT : int {static}
|
||||
+ SERVICE_BANK_ACCOUNT : String {static}
|
||||
+ SERVICE_BANK_ACCOUNT_BALANCE : int {static}
|
||||
+ TICKET_PRIZE : int {static}
|
||||
- LotteryConstants()
|
||||
}
|
||||
class LotteryNumbers {
|
||||
+ MAX_NUMBER : int {static}
|
||||
+ MIN_NUMBER : int {static}
|
||||
+ NUM_NUMBERS : int {static}
|
||||
- numbers : Set<Integer>
|
||||
- LotteryNumbers()
|
||||
- LotteryNumbers(givenNumbers : Set<Integer>)
|
||||
+ create(givenNumbers : Set<Integer>) : LotteryNumbers {static}
|
||||
+ createRandom() : LotteryNumbers {static}
|
||||
+ equals(obj : Object) : boolean
|
||||
- generateRandomNumbers()
|
||||
+ getNumbers() : Set<Integer>
|
||||
+ getNumbersAsString() : String
|
||||
+ hashCode() : int
|
||||
+ toString() : String
|
||||
}
|
||||
-class RandomNumberGenerator {
|
||||
- randomIterator : OfInt
|
||||
+ RandomNumberGenerator(min : int, max : int)
|
||||
+ nextInt() : int
|
||||
}
|
||||
class LotteryService {
|
||||
- notifications : LotteryEventLog
|
||||
- repository : LotteryTicketRepository
|
||||
- wireTransfers : WireTransfers
|
||||
+ LotteryService(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers)
|
||||
+ checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult
|
||||
+ submitTicket(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||
}
|
||||
class LotteryTicket {
|
||||
- id : LotteryTicketId
|
||||
- lotteryNumbers : LotteryNumbers
|
||||
- playerDetails : PlayerDetails
|
||||
+ LotteryTicket(id : LotteryTicketId, details : PlayerDetails, numbers : LotteryNumbers)
|
||||
+ equals(obj : Object) : boolean
|
||||
+ getId() : LotteryTicketId
|
||||
+ getNumbers() : LotteryNumbers
|
||||
+ getPlayerDetails() : PlayerDetails
|
||||
+ hashCode() : int
|
||||
+ setId(id : LotteryTicketId)
|
||||
+ toString() : String
|
||||
}
|
||||
class LotteryTicketCheckResult {
|
||||
- checkResult : CheckResult
|
||||
- prizeAmount : int
|
||||
+ LotteryTicketCheckResult(result : CheckResult)
|
||||
+ LotteryTicketCheckResult(result : CheckResult, amount : int)
|
||||
+ equals(obj : Object) : boolean
|
||||
+ getPrizeAmount() : int
|
||||
+ getResult() : CheckResult
|
||||
+ hashCode() : int
|
||||
}
|
||||
enum CheckResult {
|
||||
+ NO_PRIZE {static}
|
||||
+ TICKET_NOT_SUBMITTED {static}
|
||||
+ WIN_PRIZE {static}
|
||||
+ valueOf(name : String) : CheckResult {static}
|
||||
+ values() : CheckResult[] {static}
|
||||
}
|
||||
class LotteryTicketId {
|
||||
- id : int
|
||||
- numAllocated : AtomicInteger {static}
|
||||
+ LotteryTicketId()
|
||||
+ LotteryTicketId(id : int)
|
||||
+ equals(o : Object) : boolean
|
||||
+ getId() : int
|
||||
+ hashCode() : int
|
||||
+ toString() : String
|
||||
}
|
||||
class LotteryUtils {
|
||||
- LotteryUtils()
|
||||
+ checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static}
|
||||
}
|
||||
class PlayerDetails {
|
||||
- bankAccountNumber : String
|
||||
- emailAddress : String
|
||||
- phoneNumber : String
|
||||
+ PlayerDetails(email : String, bankAccount : String, phone : String)
|
||||
+ equals(obj : Object) : boolean
|
||||
+ getBankAccount() : String
|
||||
+ getEmail() : String
|
||||
+ getPhoneNumber() : String
|
||||
+ hashCode() : int
|
||||
+ toString() : String
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.banking {
|
||||
class InMemoryBank {
|
||||
- accounts : Map<String, Integer> {static}
|
||||
+ InMemoryBank()
|
||||
+ getFunds(bankAccount : String) : int
|
||||
+ setFunds(bankAccount : String, amount : int)
|
||||
+ transferFunds(amount : int, sourceAccount : String, destinationAccount : String) : boolean
|
||||
}
|
||||
class MongoBank {
|
||||
- DEFAULT_ACCOUNTS_COLLECTION : String {static}
|
||||
- DEFAULT_DB : String {static}
|
||||
- accountsCollection : MongoCollection<Document>
|
||||
- database : MongoDatabase
|
||||
- mongoClient : MongoClient
|
||||
+ MongoBank()
|
||||
+ MongoBank(dbName : String, accountsCollectionName : String)
|
||||
+ connect()
|
||||
+ connect(dbName : String, accountsCollectionName : String)
|
||||
+ getAccountsCollection() : MongoCollection<Document>
|
||||
+ getFunds(bankAccount : String) : int
|
||||
+ getMongoClient() : MongoClient
|
||||
+ getMongoDatabase() : MongoDatabase
|
||||
+ setFunds(bankAccount : String, amount : int)
|
||||
+ transferFunds(amount : int, sourceAccount : String, destinationAccount : String) : boolean
|
||||
}
|
||||
interface WireTransfers {
|
||||
+ getFunds(String) : int {abstract}
|
||||
+ setFunds(String, int) {abstract}
|
||||
+ transferFunds(int, String, String) : boolean {abstract}
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.database {
|
||||
class InMemoryTicketRepository {
|
||||
- tickets : Map<LotteryTicketId, LotteryTicket> {static}
|
||||
+ InMemoryTicketRepository()
|
||||
+ deleteAll()
|
||||
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
||||
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
||||
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||
}
|
||||
interface LotteryTicketRepository {
|
||||
+ deleteAll() {abstract}
|
||||
+ findAll() : Map<LotteryTicketId, LotteryTicket> {abstract}
|
||||
+ findById(LotteryTicketId) : Optional<LotteryTicket> {abstract}
|
||||
+ save(LotteryTicket) : Optional<LotteryTicketId> {abstract}
|
||||
}
|
||||
class MongoTicketRepository {
|
||||
- DEFAULT_COUNTERS_COLLECTION : String {static}
|
||||
- DEFAULT_DB : String {static}
|
||||
- DEFAULT_TICKETS_COLLECTION : String {static}
|
||||
- countersCollection : MongoCollection<Document>
|
||||
- database : MongoDatabase
|
||||
- mongoClient : MongoClient
|
||||
- ticketsCollection : MongoCollection<Document>
|
||||
+ MongoTicketRepository()
|
||||
+ MongoTicketRepository(dbName : String, ticketsCollectionName : String, countersCollectionName : String)
|
||||
+ connect()
|
||||
+ connect(dbName : String, ticketsCollectionName : String, countersCollectionName : String)
|
||||
+ deleteAll()
|
||||
- docToTicket(doc : Document) : LotteryTicket
|
||||
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
||||
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
||||
+ getCountersCollection() : MongoCollection<Document>
|
||||
+ getNextId() : int
|
||||
+ getTicketsCollection() : MongoCollection<Document>
|
||||
- initCounters()
|
||||
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal {
|
||||
class App {
|
||||
+ App()
|
||||
+ main(args : String[]) {static}
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.administration {
|
||||
class ConsoleAdministration {
|
||||
- LOGGER : Logger {static}
|
||||
+ ConsoleAdministration()
|
||||
+ main(args : String[]) {static}
|
||||
- printMainMenu() {static}
|
||||
- readString(scanner : Scanner) : String {static}
|
||||
}
|
||||
interface ConsoleAdministrationSrv {
|
||||
+ getAllSubmittedTickets() {abstract}
|
||||
+ performLottery() {abstract}
|
||||
+ resetLottery() {abstract}
|
||||
}
|
||||
class ConsoleAdministrationSrvImpl {
|
||||
- administration : LotteryAdministration
|
||||
- logger : Logger
|
||||
+ ConsoleAdministrationSrvImpl(administration : LotteryAdministration, logger : Logger)
|
||||
+ getAllSubmittedTickets()
|
||||
+ performLottery()
|
||||
+ resetLottery()
|
||||
}
|
||||
}
|
||||
package com.iluwatar.hexagonal.eventlog {
|
||||
interface LotteryEventLog {
|
||||
+ prizeError(PlayerDetails, int) {abstract}
|
||||
+ ticketDidNotWin(PlayerDetails) {abstract}
|
||||
+ ticketSubmitError(PlayerDetails) {abstract}
|
||||
+ ticketSubmitted(PlayerDetails) {abstract}
|
||||
+ ticketWon(PlayerDetails, int) {abstract}
|
||||
}
|
||||
class MongoEventLog {
|
||||
- DEFAULT_DB : String {static}
|
||||
- DEFAULT_EVENTS_COLLECTION : String {static}
|
||||
- database : MongoDatabase
|
||||
- eventsCollection : MongoCollection<Document>
|
||||
- mongoClient : MongoClient
|
||||
- stdOutEventLog : StdOutEventLog
|
||||
+ MongoEventLog()
|
||||
+ MongoEventLog(dbName : String, eventsCollectionName : String)
|
||||
+ connect()
|
||||
+ connect(dbName : String, eventsCollectionName : String)
|
||||
+ getEventsCollection() : MongoCollection<Document>
|
||||
+ getMongoClient() : MongoClient
|
||||
+ getMongoDatabase() : MongoDatabase
|
||||
+ prizeError(details : PlayerDetails, prizeAmount : int)
|
||||
+ ticketDidNotWin(details : PlayerDetails)
|
||||
+ ticketSubmitError(details : PlayerDetails)
|
||||
+ ticketSubmitted(details : PlayerDetails)
|
||||
+ ticketWon(details : PlayerDetails, prizeAmount : int)
|
||||
}
|
||||
class StdOutEventLog {
|
||||
- LOGGER : Logger {static}
|
||||
+ StdOutEventLog()
|
||||
+ prizeError(details : PlayerDetails, prizeAmount : int)
|
||||
+ ticketDidNotWin(details : PlayerDetails)
|
||||
+ ticketSubmitError(details : PlayerDetails)
|
||||
+ ticketSubmitted(details : PlayerDetails)
|
||||
+ ticketWon(details : PlayerDetails, prizeAmount : int)
|
||||
}
|
||||
}
|
||||
LotteryTicket --> "-playerDetails" PlayerDetails
|
||||
MongoEventLog --> "-stdOutEventLog" StdOutEventLog
|
||||
LotteryService --> "-wireTransfers" WireTransfers
|
||||
LotteryAdministration --> "-notifications" LotteryEventLog
|
||||
LotteryAdministration --> "-wireTransfers" WireTransfers
|
||||
LotteryTicket --> "-id" LotteryTicketId
|
||||
LotteryAdministration --> "-repository" LotteryTicketRepository
|
||||
LotteryService --> "-notifications" LotteryEventLog
|
||||
LotteryTicket --> "-lotteryNumbers" LotteryNumbers
|
||||
SampleData --> "-PLAYERS" PlayerDetails
|
||||
ConsoleAdministrationSrvImpl --> "-administration" LotteryAdministration
|
||||
RandomNumberGenerator ..+ LotteryNumbers
|
||||
LotteryService --> "-repository" LotteryTicketRepository
|
||||
CheckResult ..+ LotteryTicketCheckResult
|
||||
LotteryTicketCheckResult --> "-checkResult" CheckResult
|
||||
ConsoleAdministrationSrvImpl ..|> ConsoleAdministrationSrv
|
||||
InMemoryBank ..|> WireTransfers
|
||||
MongoBank ..|> WireTransfers
|
||||
InMemoryTicketRepository ..|> LotteryTicketRepository
|
||||
MongoTicketRepository ..|> LotteryTicketRepository
|
||||
MongoEventLog ..|> LotteryEventLog
|
||||
StdOutEventLog ..|> LotteryEventLog
|
||||
LotteryConsoleServiceImpl ..|> LotteryConsoleService
|
||||
@enduml
|
||||
Reference in New Issue
Block a user