mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 14:16:02 +00:00
* #1299 IMPLEMENT IDENTITY MAP PATTERN. * #1299 Add docstrings, README, testCases and class diagram. * #1299 Update a comment string in DB implementation. * #1299 Fix code smells. * #1299 Fix code smells and add comments to App.java * #1299 Update constant name. * #1299 Remove java version dependency and update README.md. * #1299 Add lombok to PersonFinder.java. * #1299 Add dependency to maven-assembly-plugin. * #1299 Use java streams in PersonDbSimulatorImplementation.java. * #1299 Add print statements while returning the person object. * #1299 Update README.md. * #1299 Add puml file. * Update README.md
This commit is contained in:
1 parent
3831a82b69
commit
d2599a2904
17 files changed
+1176
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
@@ -0,0 +1,67 @@
|
||||
@startuml
|
||||
package com.iluwatar.identitymap {
|
||||
class App {
|
||||
- LOGGER : Logger {static}
|
||||
+ App()
|
||||
+ main(args : String[]) {static}
|
||||
}
|
||||
class IdentityMap {
|
||||
- LOGGER : Logger {static}
|
||||
- personMap : Map<Integer, Person>
|
||||
+ IdentityMap()
|
||||
+ addPerson(person : Person)
|
||||
+ getPerson(id : int) : Person
|
||||
+ getPersonMap() : Map<Integer, Person>
|
||||
+ size() : int
|
||||
}
|
||||
class Person {
|
||||
- name : String
|
||||
- personNationalId : int
|
||||
- phoneNum : long
|
||||
- serialVersionUID : long {static}
|
||||
+ Person(personNationalId : int, name : String, phoneNum : long)
|
||||
+ equals(o : Object) : boolean
|
||||
+ getName() : String
|
||||
+ getPersonNationalId() : int
|
||||
+ getPhoneNum() : long
|
||||
+ hashCode() : int
|
||||
+ setName(name : String)
|
||||
+ setPersonNationalId(personNationalId : int)
|
||||
+ setPhoneNum(phoneNum : long)
|
||||
+ toString() : String
|
||||
}
|
||||
interface PersonDbSimulator {
|
||||
+ delete(int) {abstract}
|
||||
+ find(int) : Person {abstract}
|
||||
+ insert(Person) {abstract}
|
||||
+ update(Person) {abstract}
|
||||
}
|
||||
class PersonDbSimulatorImplementation {
|
||||
~ ID_STR : String {static}
|
||||
- LOGGER : Logger {static}
|
||||
~ NOT_IN_DATA_BASE : String {static}
|
||||
- personList : List<Person>
|
||||
+ PersonDbSimulatorImplementation()
|
||||
+ delete(id : int)
|
||||
+ find(personNationalID : int) : Person
|
||||
+ insert(person : Person)
|
||||
+ size() : int
|
||||
+ update(person : Person)
|
||||
}
|
||||
class PersonFinder {
|
||||
- LOGGER : Logger {static}
|
||||
- db : PersonDbSimulatorImplementation
|
||||
- identityMap : IdentityMap
|
||||
+ PersonFinder()
|
||||
+ getDB() : PersonDbSimulatorImplementation
|
||||
+ getIdentityMap() : IdentityMap
|
||||
+ getPerson(key : int) : Person
|
||||
+ setDb(db : PersonDbSimulatorImplementation)
|
||||
+ setIdentityMap(identityMap : IdentityMap)
|
||||
}
|
||||
}
|
||||
PersonFinder --> "-db" PersonDbSimulatorImplementation
|
||||
PersonFinder --> "-identityMap" IdentityMap
|
||||
PersonDbSimulatorImplementation --> "-personList" Person
|
||||
PersonDbSimulatorImplementation ..|> PersonDbSimulator
|
||||
@enduml
|
||||
Reference in new issue
Block a user