public class MyModel {
private final com.google.gson.Gson gson = new Gson();
private final SomeData someData = new SomeData();
private class SomeData extends JsonModel() {
String text = "text";
}
private class JsonModel() {
public String toJson() {
return gson.toJson(this);
}
}
public SomeData getSomeData() {
return someData;
}
}
假设MyModel
在FTL中可以myModel
访问,为什么myModel.someData.toJson
或myModel.getSomeData().toJson()
会因The following has evaluated to null or missing: myModel.someData.toJson
或The following has evaluated to null or missing: myModel.getSomeData().toJson()
而失败?
答案 0 :(得分:2)
JsonModel
必须是公开的,否则其成员不会被曝光。