Files
JurenXu b103e44ecd 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>
2022-11-13 09:43:03 +02:00

56 lines
1.6 KiB
Plaintext

@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