I am trying to use flexjson
library. But in my object I have to use:
com.google.api.client.util.DateTime
which do not have no parameters constructor. I always get NoSuchMethodException
with message: Flexjson will instantiate any protected, private, or public no-arg constructor.
I have sources and trying to do something with that, here is the code:
constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
Exception is being thrown in clazz.getDeclaredConstructor()
due to lacking empty constructor. What is the best approach to find constructor with let's say those signature:
DateTime(long timestamp)
?
Have anyone encounter this kind of problem with this library? Maybe you can suggest to use other one. I am using it to serialize objects generated by Google Cloud Endpoints
. Maybe I can do that with different approach?