我正在尝试使用flexjson库。但是在我的对象中我必须使用:
com.google.api.client.util.DateTime它没有没有参数的构造函数。我总是收到NoSuchMethodException消息:Flexjson will instantiate any protected, private, or public no-arg constructor.我有资源并试图用它做点什么,这里是代码:
constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
clazz.getDeclaredConstructor()由于缺少空构造函数而引发异常。假设这些签名,找到构造函数的最佳方法是什么:
DateTime(long timestamp)?
有人在这个库中遇到过这种问题吗?也许你可以建议使用其他的。我正在使用它来序列化由Google Cloud Endpoints. 也许我可以用不同的方法做到这一点?