We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rt,目前需要写个插件,可生成class中包含一个static方法,用于从jsonObject转化为class实体类,不知插件是否支持?
e.g: json: { "a":1,"b":true,"c":""} 转化为data class: data class Test ( val a: Int, val b: Boolean, val c: String ) { companion object {
@JvmStatic fun buildFromJson(jsonObject: JSONObject?): Test? { jsonObject?.run { return Test( optInt("a"), optBoolean("b"), optString("c") ) } return null } }
}
The text was updated successfully, but these errors were encountered:
@varenyzc 支持的,格式模板需要你自己填充实现,可以参考: https://github.com/wuseal/JsonToKotlinClass/blob/master/src/main/kotlin/extensions/nstd/ReplaceConstructorParametersByMemberVariablesSupport.kt 这个无参构造函数的功能
自己实现一个·KotlinCodeBuilder
KotlinCodeBuilder
https://github.com/wuseal/JsonToKotlinClass/blob/master/src/main/kotlin/wu/seal/jsontokotlin/model/builder/KotlinCodeBuilder.kt
Sorry, something went wrong.
@wuseal 感谢回复。已在实现中~
Implemented by @varenyzc #349
varenyzc
No branches or pull requests
rt,目前需要写个插件,可生成class中包含一个static方法,用于从jsonObject转化为class实体类,不知插件是否支持?
e.g:
json: { "a":1,"b":true,"c":""}
转化为data class:
data class Test (
val a: Int,
val b: Boolean,
val c: String
) {
companion object {
}
The text was updated successfully, but these errors were encountered: