mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-17 08:24:38 +00:00
feature: Implement Serialized Entity Pattern (#2150)
* Add files: - App.java - Country.java - CountryDao.java - CountrySchemaSql.java - CountryTest.java - README.md - serialize-entity.urm.puml - pom.xml (inherit from parent pom.xml) Update files: - pom.xml (parent pom.xml, add 1 module called serialized-entity) * Fix duplicated error in pom.xml * Update: - pom.xml (module servant, changed by error, now fixed) - pom.xml (module serialized-entity) * Update: - pom.xml (changed, artifactId) * Update: - pom.xml Add: AppTest.java * Resolved changes required by the reviewer Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
@@ -0,0 +1,56 @@
|
||||
@startuml
|
||||
package com.iluwatar.serializedentity {
|
||||
class App {
|
||||
- DB_URL : String {static}
|
||||
- LOGGER : Logger {static}
|
||||
+ App()
|
||||
- createDataSource() : DataSource {static}
|
||||
- createSchema(dataSource : DataSource) {static}
|
||||
- deleteSchema(dataSource : DataSource) {static}
|
||||
+ main(args : String[]) {static}
|
||||
}
|
||||
|
||||
class Country {
|
||||
- code : int
|
||||
- name : String
|
||||
- continents : String
|
||||
- language : String
|
||||
+ serialVersionUID : final Long {static}
|
||||
~Country(int, String, String, String)
|
||||
+ getCode() : int
|
||||
+ getName() : String
|
||||
+ getContinents() : String
|
||||
+ getLanguage() : String
|
||||
+ setCode(code : int)
|
||||
+ setName(name : String)
|
||||
+ setContinents(continents : String)
|
||||
+ setLanguage(language : String)
|
||||
+ equals(that: Object) : boolean
|
||||
+ hashCode() : int
|
||||
+ toString() : String
|
||||
}
|
||||
|
||||
interface CountryDao {
|
||||
+ insertCountry : int {abstract}
|
||||
+ selectCountry : int {abstract}
|
||||
}
|
||||
|
||||
class CountrySchemaSql {
|
||||
- CREATE_SCHEMA_SQL : String {static}
|
||||
- DELETE_SCHEMA_SQL : String {static}
|
||||
- LOGGER : Logger {static}
|
||||
- dataSource : DataSource
|
||||
- country : Country
|
||||
~ CountrySchemaSql(country : Country, dataSource : DataSource)
|
||||
+ insertCountry()
|
||||
+ selectCountry()
|
||||
}
|
||||
diamond h2db
|
||||
}
|
||||
|
||||
App --> "Initialize Country objects" Country
|
||||
App --> "Initialize CountrySchemaSql" CountrySchemaSql
|
||||
CountrySchemaSql --> "implements" CountryDao
|
||||
Country --> "Stored in database" h2db
|
||||
CountrySchemaSql --> "Perform INSERT and SELECT operation after serialize and deserialize Country object" h2db
|
||||
@enduml
|
||||
Reference in New Issue
Block a user