forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdao.urm.puml
More file actions
65 lines (65 loc) · 2.07 KB
/
dao.urm.puml
File metadata and controls
65 lines (65 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@startuml
package com.iluwatar.dao {
class Customer {
- firstName : String
- id : int
- lastName : String
+ Customer(id : int, firstName : String, lastName : String)
+ equals(that : Object) : boolean
+ getFirstName() : String
+ getId() : int
+ getLastName() : String
+ hashCode() : int
+ setFirstName(firstName : String)
+ setId(id : int)
+ setLastName(lastName : String)
+ toString() : String
}
interface CustomerDao {
+ add(Customer) : boolean {abstract}
+ delete(Customer) : boolean {abstract}
+ getAll() : Stream<Customer> {abstract}
+ getById(int) : Optional<Customer> {abstract}
+ update(Customer) : boolean {abstract}
}
class DbCustomerDao {
- dataSource : DataSource
+ DbCustomerDao(dataSource : DataSource)
+ add(customer : Customer) : boolean
- createCustomer(resultSet : ResultSet) : Customer
+ delete(customer : Customer) : boolean
+ getAll() : Stream<Customer>
+ getById(id : int) : Optional<Customer>
- getConnection() : Connection
- mutedClose(connection : Connection)
+ update(customer : Customer) : boolean
}
class InMemoryCustomerDao {
- idToCustomer : Map<Integer, Customer>
+ InMemoryCustomerDao()
+ add(customer : Customer) : boolean
+ delete(customer : Customer) : boolean
+ getAll() : Stream<Customer>
+ getById(id : int) : Optional<Customer>
+ update(customer : Customer) : boolean
}
interface CustomerSchemaSql {
+ CREATE_SCHEMA_SQL : String {static}
+ DELETE_SCHEMA_SQL : String {static}
}
class App {
- DB_URL : String {static}
- log : Logger {static}
+ App()
- addCustomers(customerDao : CustomerDao) {static}
- createDataSource() : DataSource {static}
- createSchema(dataSource : DataSource) {static}
- deleteSchema(dataSource : DataSource) {static}
+ generateSampleCustomers() : List<Customer> {static}
+ main(args : String[]) {static}
- performOperationsUsing(customerDao : CustomerDao) {static}
}
}
DbCustomerDao ..|> CustomerDao
InMemoryCustomerDao ..|> CustomerDao
@enduml