JsonToKotlinClass
JsonToKotlinClass copied to clipboard
Enable Default Constructor Creation Option
In the case when we want to send a class out as a Request, it would be useful to create a constructor with default arguments in some cases, which we could change later. For example, see constructor() at the bottom of this code:
data class Activity(
var updated_on: String,
var tags: List<String>,
var description: String,
var user_id: List<Int>,
var status_id: Int,
var title: String,
var created_at: String,
var data: HashMap<*, *>,
var id: Int,
var counts: LinkedTreeMap<*, *>
) {
constructor() : this("", emptyList(),
"", emptyList(), -1,
"", "", hashMapOf<Any, Any>(),
-1, LinkedTreeMap<Any, Any>()
)
}
Enable init with default value option in settings and then it will generate data class with init value, the effect is the same as your descriptions
When data class all fields initial with default value it will auto has a default construct that no need pass parameters when new a data class object