mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 13:26:03 +00:00
2d54709d1a
* Implement Gateway pattern * Fixed docstrings * Fixed README.md * Fixed App * Fixed pom.xml * Fixed pom.xml * Fixed pom.xml * Fixed pom.xml * fixed checkstyle errors and directory names * fixed pom.xml * fixed checkstyle errors * Bug fixed * Bug fixed * Bug fixed * Bug fixed and code improvement * Bug fixed and code improvement * Bug fixed and update README.md * update APP.java * update gateway pattern * Revert "update gateway pattern" This reverts commit f31a00c268889b2c6b7690e07847df7247725999. * update gateway pattern --------- Co-authored-by: Finn <u7552286@anu.edu.au>
44 lines
813 B
Plaintext
44 lines
813 B
Plaintext
@startuml GatewayPattern
|
|
package com.iluwatar.gateway{
|
|
class App {
|
|
+main(args: String[]): void
|
|
}
|
|
|
|
class GatewayFactory {
|
|
-gateways: Map<String, Gateway>
|
|
+registerGateway(key: String, gateway: Gateway): void
|
|
+getGateway(key: String): Gateway
|
|
}
|
|
|
|
interface Gateway {
|
|
{abstract} +execute(): void
|
|
}
|
|
|
|
class ExternalServiceA {
|
|
+execute(): void
|
|
}
|
|
|
|
class ExternalServiceB {
|
|
+execute(): void
|
|
}
|
|
|
|
class ExternalServiceC {
|
|
+execute(): void
|
|
+error(): void
|
|
}
|
|
|
|
App --> GatewayFactory : Uses
|
|
|
|
|
|
GatewayFactory --> Gateway : Creates
|
|
|
|
GatewayFactory --> ExternalServiceA : Registers
|
|
GatewayFactory --> ExternalServiceB : Registers
|
|
GatewayFactory --> ExternalServiceC : Registers
|
|
|
|
ExternalServiceA --> Gateway : Implements
|
|
ExternalServiceB --> Gateway : Implements
|
|
ExternalServiceC --> Gateway : Implements
|
|
|
|
@enduml
|