{"action":"created","issue":{"url":"https://api.github.com/repos/rharter/auto-value-gson/issues/19","repository_url":"https://api.github.com/repos/rharter/auto-value-gson","labels_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/19/comments","events_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/19/events","html_url":"https://github.com/rharter/auto-value-gson/issues/19","id":144009313,"number":19,"title":"Support single TypeAdapterFactory for all AutoValue generated type adapters.","user":{"login":"rharter","id":1296750,"avatar_url":"https://avatars.githubusercontent.com/u/1296750?v=3","gravatar_id":"","url":"https://api.github.com/users/rharter","html_url":"https://github.com/rharter","followers_url":"https://api.github.com/users/rharter/followers","following_url":"https://api.github.com/users/rharter/following{/other_user}","gists_url":"https://api.github.com/users/rharter/gists{/gist_id}","starred_url":"https://api.github.com/users/rharter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rharter/subscriptions","organizations_url":"https://api.github.com/users/rharter/orgs","repos_url":"https://api.github.com/users/rharter/repos","events_url":"https://api.github.com/users/rharter/events{/privacy}","received_events_url":"https://api.github.com/users/rharter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-28T15:48:44Z","updated_at":"2016-04-15T13:19:11Z","closed_at":null,"body":"The currently TypeAdapterFactory mechanism requires users to add each individual TypeAdapterFactory to each Gson instance in order to de/serialize objects.  This can be cumbersome, especially when you have a large number of model objects.  \r\n\r\nAs long as we're already generating code, we could alleviate this by generating a single `AutoValueTypeAdapterFactory` that will serve as TypeAdapterFactory for all AutoValue: Gson generated type adapters.  This can use the standard TypeAdapterFactory mechanism to check the class type and delegate the request to the appropriate TypeAdapter.\r\n\r\nThe challenge I see here is that the AutoValue Extension mechanism processes classes serially, meaning this would require an additional annotation process that processes the same `@AutoValue` annotation, checks applicability, and generates a single `AutoValueTypeAdapterFactory` for all applicable classes.\r\n\r\nThis would reduce the code needed to configure your Gson instance to the following:\r\n\r\n```java\r\nGson gson = new GsonBuilder()\r\n  .registerTypeAdapterFactory(new AutoValueTypeAdapterFactory())\r\n  .build();\r\n```"},"comment":{"url":"https://api.github.com/repos/rharter/auto-value-gson/issues/comments/210461560","html_url":"https://github.com/rharter/auto-value-gson/issues/19#issuecomment-210461560","issue_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/19","id":210461560,"user":{"login":"outlying","id":2069751,"avatar_url":"https://avatars.githubusercontent.com/u/2069751?v=3","gravatar_id":"","url":"https://api.github.com/users/outlying","html_url":"https://github.com/outlying","followers_url":"https://api.github.com/users/outlying/followers","following_url":"https://api.github.com/users/outlying/following{/other_user}","gists_url":"https://api.github.com/users/outlying/gists{/gist_id}","starred_url":"https://api.github.com/users/outlying/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outlying/subscriptions","organizations_url":"https://api.github.com/users/outlying/orgs","repos_url":"https://api.github.com/users/outlying/repos","events_url":"https://api.github.com/users/outlying/events{/privacy}","received_events_url":"https://api.github.com/users/outlying/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T13:19:11Z","updated_at":"2016-04-15T13:19:11Z","body":"Thanks, I did not know whether you are working on it or not. I will start next week."}}