While following the Gmail API java quickstart guide  I came across this code snippet:
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
Using it in the editor gave me a warning that it is deprecated. What are my options?
Look up the API documentation of class JacksonFactory.
It tells you what to do:
Deprecated.
use com.google.api.client.json.GsonFactory instead
Looking into the API documentation of class GsonFactory
you see, its API methods are compatible to those of JacksonFactory,
since both extend from the same superclass JsonFactory.
(Only their internal implementations are different, of course.)
Therefore it is simple to change your code. Just to replace the line
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
by
private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance();
The actual class is com.google.api.client.json.**gson.**GsonFactory. The deprecation message is missing ".gson".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With