[英]Backend Endpoint Class in Google Cloud Module not Updating (Android)
I have a class which is used to generate endpoints to the save in Google Cloud Datastore. 我有一个用于生成端点以保存到Google Cloud Datastore中的端点的类。 I populate objects of this class on the application side and then call the generated API to store them (I'm using Objectify)
我在应用程序端填充此类的对象,然后调用生成的API来存储它们(我正在使用Objectify)
I've recently added a new field of type List<String>
including a method to add strings to the list. 我最近添加了一个类型为
List<String>
的新字段,其中包括一种将字符串添加到列表的方法。 However on the application said I can only see the old version of the class (which is imported from backend.MyApi.model.MyClass
) 但是在应用程序上说我只能看到该类的旧版本(该类是从
backend.MyApi.model.MyClass
导入的)
The culprit according to Android Studio is in backend/build/libs/backend-android-endpoints.jar which has a MyClass.class object 根据Android Studio的原因是在backend / build / libs / backend-android-endpoints.jar中,该对象具有MyClass.class对象
I've tried deleting the build files in the backend module, cleaning and rebuilding but it still uses the old version 我尝试删除后端模块中的构建文件,进行清理和重建,但是它仍然使用旧版本
How do I force the class to be rebuilt using the new source to include the new fields/methods? 如何强制使用新的源来重建类以包含新的字段/方法?
So I think I've found the solution. 所以我想我已经找到了解决方案。
Any class defined as an entity by Objectify shows up in API.model but only with getters and setters for its defined fields. 由Objectify定义为实体的任何类都显示在API.model中,但其定义字段仅具有getter和setter。 Therefore my add method isn't part of it
因此,我的添加方法不属于其中
Therefore to include the functionality of add()
instead on the application side I write 因此,我在应用程序端
add()
的功能,
List<String> classList = classInstance.getClassList();
String stringToAdd = "Blah";
if (!classList.contains(stringToAdd))
{
classList.add(stringToAdd);
classInstance.setClassList(classList)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.