Closed williamwebb closed 8 years ago
I don't think that really fits.
First of all, this isn't an Android project, it's a Java project. I'm sure you were thinking of an AAR in addition to a JAR, but I'm not sure that it makes sense just for a lint check.
Secondly, not having a typeAdapter
method is completely valid. The idea is that you might not want all AutoValue annotated classes to have generated type adapters. In my cases, this is particularly useful since I use AutoValue types for local db related items in addition to objects returns from the web services, but only the remote items need type adapters.
If there's something I'm missing, I'm happy to discuss.
No you understood correctly.
For my information the adapter is always created regardless if the method is present or not correct?
No, you do need to include a public static method returning a TypeAdapter<Foo>
that takes a Gson object. That's how the extension determines if it should generate a TypeAdapter or not. That is defined here
Gotcha, makes a lost more sense now :). Thanks.
Would you/this project be interested in the addition of a aar distribution containing a lint check which validates that an AutoValue annotated class has the typeAdapter method added?