Files
Chak-C e223459db8 feature: Add context object pattern (#2304)
* Add context object pattern and corresponding tests

* Update context pattern

* Add README, class diagram, puml file.
Add toString method in ServiceContext.java.
Add tests for coverage.

* Improvements:
Remove plugin in pom file
Add comments in app.java
Change local variable keyword to var in app.java
Use lombok for getters, setters and tostring
Change method signature in context object

* Refreshing environment-1

* Reconfigure pom file.

Co-authored-by: Alvis Chan <u7287079@edu.anu.au>
Co-authored-by: u7287079 <u7287079@anu.edu.au>
2022-12-29 11:17:28 +02:00

50 lines
1.2 KiB
Plaintext

@startuml
package com.iluwatar.context.object {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
}
class ServiceContext {
- ACCOUNT_SERVICE : String
- SESSION_SERVICE : String
- SEARCH_SERVICE : String
+ ServiceContext()
+ getACCOUNT_SERVICE() : String
+ getSESSION_SERVICE() : String
+ getSEARCH_SERVICE() : String
+ setACCOUNT_SERVICE(service : String)
+ setSESSION_SERVICE(service : String)
+ setSEARCH_SERVICE(service : String)
}
class ServiceContextFactory {
+ ServiceContextFactory()
+ createContext() : ServiceContext
}
class LayerA {
- context : ServiceContext
+ LayerA()
+ getContext() : ServiceContext
+ addAccountInfo()
}
class LayerB {
- context : ServiceContext
+ LayerB(layerA : LayerA)
+ getContext() : ServiceContext
+ addAccountInfo()
}
class LayerC {
- context : ServiceContext
+ LayerC(layerB : LayerB)
+ getContext() : ServiceContext
+ addAccountInfo()
}
}
LayerC ..|> LayerB
ServiceContext --> LayerC
ServiceContext --> LayerB
ServiceContext --> LayerA
ServiceContextFactory ..|> "<<creates>>" ServiceContext
LayerB ..|> LayerA
@enduml