[英]How to generate default values for a data class / POJO (in Kotlin/Java)?
[英]How to access kotlin pojo in java class
class Example {
@SerializedName("foo")
@Expose
var foo: String? = null
@SerializedName("bar")
@Expose
var bar: String? = null
@SerializedName("baz")
@Expose
var baz: String? = null
}
如何在Java類中訪問Kotlin Pojo類屬性
我們可以如下訪問
Example example = new Example();
example.setBar("");
example.setBaz("");
example.setFoo("");
example.getBar();
example.getBaz();
example.getFoo();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.