Created
September 3, 2019 22:56
-
-
Save DenisBronx/05a5a3160eb4a6afe63abf5b1c2bcd20 to your computer and use it in GitHub Desktop.
Repository Pattern Product with new field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Entity | |
data class Product( | |
val id: String, | |
val name: String, | |
val price: Price, | |
val isFavourite: Boolean | |
) { | |
// Value object | |
data class Price( | |
val nowPrice: Double, | |
val wasPrice: Double | |
) { | |
companion object { | |
val EMPTY = Price(0.0, 0.0) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment