Files
java-design-patterns/identity-map/etc/identity-map.urm.puml
T
u7275858 d2599a2904 feature: #1299 Add Identity Map Pattern (#2094)
* #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
2022-11-09 21:55:44 +02:00

67 lines
2.0 KiB
Plaintext

@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