{"action":"created","issue":{"url":"https://api.github.com/repos/grandstaish/paperparcel/issues/64","repository_url":"https://api.github.com/repos/grandstaish/paperparcel","labels_url":"https://api.github.com/repos/grandstaish/paperparcel/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/grandstaish/paperparcel/issues/64/comments","events_url":"https://api.github.com/repos/grandstaish/paperparcel/issues/64/events","html_url":"https://github.com/grandstaish/paperparcel/issues/64","id":162532472,"number":64,"title":"Proposal: Adding additional property types via \"plugins\"","user":{"login":"paulblessing","id":2530991,"avatar_url":"https://avatars.githubusercontent.com/u/2530991?v=3","gravatar_id":"","url":"https://api.github.com/users/paulblessing","html_url":"https://github.com/paulblessing","followers_url":"https://api.github.com/users/paulblessing/followers","following_url":"https://api.github.com/users/paulblessing/following{/other_user}","gists_url":"https://api.github.com/users/paulblessing/gists{/gist_id}","starred_url":"https://api.github.com/users/paulblessing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulblessing/subscriptions","organizations_url":"https://api.github.com/users/paulblessing/orgs","repos_url":"https://api.github.com/users/paulblessing/repos","events_url":"https://api.github.com/users/paulblessing/events{/privacy}","received_events_url":"https://api.github.com/users/paulblessing/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-27T19:46:18Z","updated_at":"2016-06-30T03:42:55Z","closed_at":"2016-06-30T03:01:27Z","body":"The library does not currently support Guava collections such as `ImmutableList`, `Multimap`, `Multiset`, `Table`, or really any custom collection type that doesn't have a public no-arg constructor. As a general purpose library, it probably shouldn't support those in its core functionality, but having the ability to support those types would be immensely useful nonetheless.\r\n\r\nI can't come up with a way of using a `TypeAdapter` for container types such as these. The only way I can think to support custom container types would be via the ability to hook into the `DataClassParser` in order to return a custom `Property` object. We'd need to expose enough of the state currently managed by `DataClassParser` to let a plugin decide it can handle a type before letting the normal `parseProperty` logic kick in. We'd also need to expose the `parseProperty` method (or some facade for it) in order to allow custom containers to delegate the parceling of their child objects. Something roughly along these lines:\r\n\r\n```java\r\npublic interface Plugin { // name TBD\r\n\r\n  Set<TypeName> getValidTypes(); // Would be checked similar to the VALID_TYPES in DataClassParser\r\n\r\n  // method name TBD, would either return the appropriate Property or null to let the library\r\n  // (or another plugin) handle it\r\n  Property parsePropertyOrNull(TypeMirror variable, TypeMirror dataClass, boolean isNullable,\r\n      String name, /* whatever other parameters */, ChildParser childParser);\r\n\r\n}\r\n```\r\n\r\nI'm willing to work on an initial implementation / prototype if this direction seems reasonable and the functionality desirable. I've got an early proof of concept and it seems like it should all be doable, but I'd prefer not to go too far down a path if there are already implementations of something similar in the works.\r\n\r\n### Proposed implementation details\r\n\r\nI'm not seeing an obvious way to solve this in the same manner as `TypeAdapter`s with just using more annotation processing, since the plugin code would need to be actually executed during the annotation processing itself as if it were part of the `compiler` module. I think it might come down to using `ServiceLocator` to find implementations of the plugin interface."},"comment":{"url":"https://api.github.com/repos/grandstaish/paperparcel/issues/comments/229552187","html_url":"https://github.com/grandstaish/paperparcel/issues/64#issuecomment-229552187","issue_url":"https://api.github.com/repos/grandstaish/paperparcel/issues/64","id":229552187,"user":{"login":"grandstaish","id":2288921,"avatar_url":"https://avatars.githubusercontent.com/u/2288921?v=3","gravatar_id":"","url":"https://api.github.com/users/grandstaish","html_url":"https://github.com/grandstaish","followers_url":"https://api.github.com/users/grandstaish/followers","following_url":"https://api.github.com/users/grandstaish/following{/other_user}","gists_url":"https://api.github.com/users/grandstaish/gists{/gist_id}","starred_url":"https://api.github.com/users/grandstaish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grandstaish/subscriptions","organizations_url":"https://api.github.com/users/grandstaish/orgs","repos_url":"https://api.github.com/users/grandstaish/repos","events_url":"https://api.github.com/users/grandstaish/events{/privacy}","received_events_url":"https://api.github.com/users/grandstaish/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T03:42:55Z","updated_at":"2016-06-30T03:42:55Z","body":"Yeah I agree with your points. An issue was raised in a similar project around the same area as your first point (https://github.com/rharter/auto-value-parcel/issues/53), so I do plan on addressing this. And as for your second point, I'm not happy with that either because I want the method reference count as low as I can so I'll definitely address this too.\r\n\r\nI hadn't considered getting rid of the AbstractAdapter, but you're probably right here also. Especially since I can null-check in my unit tests. "}}
{"actor":{"display_login":"grandstaish"}}