如何在java类中访问kotlin pojo

问题描述 投票:0回答:1
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类属性

java kotlin pojo kotlin-android-extensions
1个回答
0
投票

我们可以访问它,如下所示

    Example example = new Example();
    example.setBar("");
    example.setBaz("");
    example.setFoo("");
    example.getBar();
    example.getBaz();
    example.getFoo();
© www.soinside.com 2019 - 2024. All rights reserved.