Skip to content

Instantly share code, notes, and snippets.

@Tonel
Last active March 10, 2021 20:09
Show Gist options
  • Save Tonel/24ae32e58cef5f72bd4c57473ed1007f to your computer and use it in GitHub Desktop.
Save Tonel/24ae32e58cef5f72bd4c57473ed1007f to your computer and use it in GitHub Desktop.
Domain model objects
class Author {
var id: Int? = null
var name: String? = null
var surname: String? = null
var birthDate: Date? = null
val books: MutableList<Book> = ArrayList()
// the default constructor is required by MapStruct to convert
// a DTO object into a model domain object
constructor()
constructor(id : Int, name: String, surname: String, birthDate: Date) {
this.id = id
this.name = name
this.surname = surname
this.birthDate = birthDate
}
constructor(id: Int, name: String, surname: String, birthDate: Date, books: List<Book>) : this(id, name, surname, birthDate) {
this.books.addAll(books)
}
}
class Book {
var id: Int? = null
var title: String? = null
var releaseDate: Date? = null
// the default constructor is required by MapStruct to convert
// a DTO object into a model domain object
constructor()
constructor(id : Int, title : String, releaseDate: Date) {
this.id = id
this.title = title
this.releaseDate = releaseDate
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment