forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iluwatar#1113 Add uml-reverse-mapper plugin
- Loading branch information
Showing
140 changed files
with
7,753 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@startuml | ||
package com.iluwatar.abstractdocument.domain.enums { | ||
enum Property { | ||
+ MODEL {static} | ||
+ PARTS {static} | ||
+ PRICE {static} | ||
+ TYPE {static} | ||
+ valueOf(name : String) : Property {static} | ||
+ values() : Property[] {static} | ||
} | ||
} | ||
package com.iluwatar.abstractdocument.domain { | ||
class Car { | ||
+ Car(properties : Map<String, Object>) | ||
} | ||
interface HasModel { | ||
+ getModel() : Optional<String> | ||
} | ||
interface HasParts { | ||
+ getParts() : Stream<Part> | ||
} | ||
interface HasPrice { | ||
+ getPrice() : Optional<Number> | ||
} | ||
interface HasType { | ||
+ getType() : Optional<String> | ||
} | ||
class Part { | ||
+ Part(properties : Map<String, Object>) | ||
} | ||
} | ||
package com.iluwatar.abstractdocument { | ||
abstract class AbstractDocument { | ||
- properties : Map<String, Object> | ||
# AbstractDocument(properties : Map<String, Object>) | ||
+ children(key : String, constructor : Function<Map<String, Object>, T>) : Stream<T> | ||
+ get(key : String) : Object | ||
+ put(key : String, value : Object) | ||
+ toString() : String | ||
} | ||
class App { | ||
- LOGGER : Logger {static} | ||
+ App() | ||
+ main(args : String[]) {static} | ||
} | ||
interface Document { | ||
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract} | ||
+ get(String) : Object {abstract} | ||
+ put(String, Object) {abstract} | ||
} | ||
} | ||
AbstractDocument ..|> Document | ||
Car ..|> HasModel | ||
Car ..|> HasPrice | ||
Car ..|> HasParts | ||
Car --|> AbstractDocument | ||
HasModel --|> Document | ||
HasParts --|> Document | ||
HasPrice --|> Document | ||
HasType --|> Document | ||
Part ..|> HasType | ||
Part ..|> HasModel | ||
Part ..|> HasPrice | ||
Part --|> AbstractDocument | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
@startuml | ||
package com.iluwatar.abstractfactory { | ||
class App { | ||
- LOGGER : Logger {static} | ||
- army : Army | ||
- castle : Castle | ||
- king : King | ||
+ App() | ||
+ createKingdom(factory : KingdomFactory) | ||
+ getArmy() : Army | ||
~ getArmy(factory : KingdomFactory) : Army | ||
+ getCastle() : Castle | ||
~ getCastle(factory : KingdomFactory) : Castle | ||
+ getKing() : King | ||
~ getKing(factory : KingdomFactory) : King | ||
+ main(args : String[]) {static} | ||
- setArmy(army : Army) | ||
- setCastle(castle : Castle) | ||
- setKing(king : King) | ||
} | ||
class FactoryMaker { | ||
+ FactoryMaker() | ||
+ makeFactory(type : KingdomType) : KingdomFactory {static} | ||
} | ||
enum KingdomType { | ||
+ ELF {static} | ||
+ ORC {static} | ||
+ valueOf(name : String) : KingdomType {static} | ||
+ values() : KingdomType[] {static} | ||
} | ||
interface Army { | ||
+ getDescription() : String {abstract} | ||
} | ||
interface Castle { | ||
+ getDescription() : String {abstract} | ||
} | ||
class ElfArmy { | ||
~ DESCRIPTION : String {static} | ||
+ ElfArmy() | ||
+ getDescription() : String | ||
} | ||
class ElfCastle { | ||
~ DESCRIPTION : String {static} | ||
+ ElfCastle() | ||
+ getDescription() : String | ||
} | ||
class ElfKing { | ||
~ DESCRIPTION : String {static} | ||
+ ElfKing() | ||
+ getDescription() : String | ||
} | ||
class ElfKingdomFactory { | ||
+ ElfKingdomFactory() | ||
+ createArmy() : Army | ||
+ createCastle() : Castle | ||
+ createKing() : King | ||
} | ||
interface King { | ||
+ getDescription() : String {abstract} | ||
} | ||
interface KingdomFactory { | ||
+ createArmy() : Army {abstract} | ||
+ createCastle() : Castle {abstract} | ||
+ createKing() : King {abstract} | ||
} | ||
class OrcArmy { | ||
~ DESCRIPTION : String {static} | ||
+ OrcArmy() | ||
+ getDescription() : String | ||
} | ||
class OrcCastle { | ||
~ DESCRIPTION : String {static} | ||
+ OrcCastle() | ||
+ getDescription() : String | ||
} | ||
class OrcKing { | ||
~ DESCRIPTION : String {static} | ||
+ OrcKing() | ||
+ getDescription() : String | ||
} | ||
class OrcKingdomFactory { | ||
+ OrcKingdomFactory() | ||
+ createArmy() : Army | ||
+ createCastle() : Castle | ||
+ createKing() : King | ||
} | ||
} | ||
KingdomType ..+ FactoryMaker | ||
App --> "-castle" Castle | ||
FactoryMaker ..+ App | ||
App --> "-king" King | ||
App --> "-army" Army | ||
ElfArmy ..|> Army | ||
ElfCastle ..|> Castle | ||
ElfKing ..|> King | ||
ElfKingdomFactory ..|> KingdomFactory | ||
OrcArmy ..|> Army | ||
OrcCastle ..|> Castle | ||
OrcKing ..|> King | ||
OrcKingdomFactory ..|> KingdomFactory | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@startuml | ||
package com.iluwatar.acyclicvisitor { | ||
interface AllModemVisitor { | ||
} | ||
class App { | ||
+ App() | ||
+ main(args : String[]) {static} | ||
} | ||
class ConfigureForDosVisitor { | ||
- LOGGER : Logger {static} | ||
+ ConfigureForDosVisitor() | ||
+ visit(hayes : Hayes) | ||
+ visit(zoom : Zoom) | ||
} | ||
class ConfigureForUnixVisitor { | ||
- LOGGER : Logger {static} | ||
+ ConfigureForUnixVisitor() | ||
+ visit(zoom : Zoom) | ||
} | ||
class Hayes { | ||
- LOGGER : Logger {static} | ||
+ Hayes() | ||
+ accept(modemVisitor : ModemVisitor) | ||
+ toString() : String | ||
} | ||
interface HayesVisitor { | ||
+ visit(Hayes) {abstract} | ||
} | ||
abstract class Modem { | ||
+ Modem() | ||
+ accept(ModemVisitor) {abstract} | ||
} | ||
interface ModemVisitor { | ||
} | ||
class Zoom { | ||
- LOGGER : Logger {static} | ||
+ Zoom() | ||
+ accept(modemVisitor : ModemVisitor) | ||
+ toString() : String | ||
} | ||
interface ZoomVisitor { | ||
+ visit(Zoom) {abstract} | ||
} | ||
} | ||
AllModemVisitor --|> ZoomVisitor | ||
AllModemVisitor --|> HayesVisitor | ||
ConfigureForDosVisitor ..|> AllModemVisitor | ||
ConfigureForUnixVisitor ..|> ZoomVisitor | ||
Hayes --|> Modem | ||
HayesVisitor --|> ModemVisitor | ||
Zoom --|> Modem | ||
ZoomVisitor --|> ModemVisitor | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@startuml | ||
package com.iluwatar.adapter { | ||
class App { | ||
- App() | ||
+ main(args : String[]) {static} | ||
} | ||
class Captain { | ||
- rowingBoat : RowingBoat | ||
+ Captain() | ||
+ Captain(boat : RowingBoat) | ||
~ row() | ||
~ setRowingBoat(boat : RowingBoat) | ||
} | ||
~class FishingBoat { | ||
- LOGGER : Logger {static} | ||
~ FishingBoat() | ||
~ sail() | ||
} | ||
class FishingBoatAdapter { | ||
- boat : FishingBoat | ||
+ FishingBoatAdapter() | ||
+ row() | ||
} | ||
interface RowingBoat { | ||
+ row() {abstract} | ||
} | ||
} | ||
FishingBoatAdapter --> "-boat" FishingBoat | ||
Captain --> "-rowingBoat" RowingBoat | ||
FishingBoatAdapter ..|> RowingBoat | ||
@enduml |
43 changes: 43 additions & 0 deletions
43
aggregator-microservices/aggregator-service/etc/aggregator-service.urm.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@startuml | ||
package com.iluwatar.aggregator.microservices { | ||
class Aggregator { | ||
- informationClient : ProductInformationClient | ||
- inventoryClient : ProductInventoryClient | ||
+ Aggregator() | ||
+ getProduct() : Product | ||
} | ||
class App { | ||
+ App() | ||
+ main(args : String[]) {static} | ||
} | ||
class Product { | ||
- productInventories : int | ||
- title : String | ||
+ Product() | ||
+ getProductInventories() : int | ||
+ getTitle() : String | ||
+ setProductInventories(productInventories : int) | ||
+ setTitle(title : String) | ||
} | ||
interface ProductInformationClient { | ||
+ getProductTitle() : String {abstract} | ||
} | ||
class ProductInformationClientImpl { | ||
- LOGGER : Logger {static} | ||
+ ProductInformationClientImpl() | ||
+ getProductTitle() : String | ||
} | ||
interface ProductInventoryClient { | ||
+ getProductInventories() : Integer {abstract} | ||
} | ||
class ProductInventoryClientImpl { | ||
- LOGGER : Logger {static} | ||
+ ProductInventoryClientImpl() | ||
+ getProductInventories() : Integer | ||
} | ||
} | ||
Aggregator --> "-informationClient" ProductInformationClient | ||
Aggregator --> "-inventoryClient" ProductInventoryClient | ||
ProductInformationClientImpl ..|> ProductInformationClient | ||
ProductInventoryClientImpl ..|> ProductInventoryClient | ||
@enduml |
2 changes: 2 additions & 0 deletions
2
aggregator-microservices/etc/aggregator-microservices.urm.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@startuml | ||
@enduml |
12 changes: 12 additions & 0 deletions
12
aggregator-microservices/information-microservice/etc/information-microservice.urm.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@startuml | ||
package com.iluwatar.information.microservice { | ||
class InformationApplication { | ||
+ InformationApplication() | ||
+ main(args : String[]) {static} | ||
} | ||
class InformationController { | ||
+ InformationController() | ||
+ getProductTitle() : String | ||
} | ||
} | ||
@enduml |
12 changes: 12 additions & 0 deletions
12
aggregator-microservices/inventory-microservice/etc/inventory-microservice.urm.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@startuml | ||
package com.iluwatar.inventory.microservice { | ||
class InventoryApplication { | ||
+ InventoryApplication() | ||
+ main(args : String[]) {static} | ||
} | ||
class InventoryController { | ||
+ InventoryController() | ||
+ getProductInventories() : int | ||
} | ||
} | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@startuml | ||
package com.iluwatar.ambassador.util { | ||
interface RandomProvider { | ||
+ random() : double {abstract} | ||
} | ||
} | ||
package com.iluwatar.ambassador { | ||
class App { | ||
+ App() | ||
+ main(args : String[]) {static} | ||
} | ||
class Client { | ||
- LOGGER : Logger {static} | ||
- serviceAmbassador : ServiceAmbassador | ||
+ Client() | ||
~ useService(value : int) : long | ||
} | ||
class RemoteService { | ||
- LOGGER : Logger {static} | ||
- THRESHOLD : int {static} | ||
- randomProvider : RandomProvider | ||
- service : RemoteService {static} | ||
- RemoteService() | ||
~ RemoteService(randomProvider : RandomProvider) | ||
+ doRemoteFunction(value : int) : long | ||
~ getRemoteService() : RemoteService {static} | ||
} | ||
~interface RemoteServiceInterface { | ||
+ FAILURE : int {static} | ||
+ doRemoteFunction(int) : long {abstract} | ||
} | ||
class ServiceAmbassador { | ||
- DELAY_MS : int {static} | ||
- LOGGER : Logger {static} | ||
- RETRIES : int {static} | ||
~ ServiceAmbassador() | ||
- checkLatency(value : int) : long | ||
+ doRemoteFunction(value : int) : long | ||
- safeCall(value : int) : long | ||
} | ||
} | ||
RemoteService --> "-service" RemoteService | ||
Client --> "-serviceAmbassador" ServiceAmbassador | ||
RemoteService --> "-randomProvider" RandomProvider | ||
RemoteService ..|> RemoteServiceInterface | ||
ServiceAmbassador ..|> RemoteServiceInterface | ||
@enduml |
Oops, something went wrong.