Created
January 2, 2018 04:15
-
-
Save xmlking/cd48ac7fc6bd98173e9bdf6d479eb4c8 to your computer and use it in GitHub Desktop.
Kotlin data class with second constructor !
This file contains hidden or 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
@NoArg | |
@JsonIgnoreProperties(ignoreUnknown = true) | |
data class Request( | |
var AAA: String?, | |
var BBB : String?, | |
var CCC: String? | |
) { | |
constructor(raw: String): this(null,null, null) { | |
val mapper = jacksonObjectMapper() | |
val request = mapper.readValue<Request>(raw) | |
this.AAA = request.AAA | |
this.BBB = request.BBB | |
this.CCC = request.CCC | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment