Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Google's AutoValue #150

Open
ZakTaccardi opened this issue Mar 29, 2016 · 8 comments
Open

Support for Google's AutoValue #150

ZakTaccardi opened this issue Mar 29, 2016 · 8 comments

Comments

@ZakTaccardi
Copy link

LoganSquare should support AutoValue's extension API. AutoValue 1.2 has hit a release candidate stage, so the time is ripe.

http://angusmorton.com/autovalue-extensions/

@EricKuck
Copy link
Member

It's on the todo list. I don't have a timeline for when work on this can begin though, so if someone wants to pick it up and do a PR in the meantime that'd be awesome.

@krystianpe
Copy link

I've been trying to write extension for LoganSquare but I don't seem to find a good way to do it. I can't annotate generated class with @JsonObject and @JsonField because then JsonMapper expects empty constructor which for AutoValue extensions can't be made. I can't implement TypeConverter<T> because it won't be used if I don't have @JsonObject model with @JsonField annotated T field. Moshi extension generates TypeAdapter<T>'s but from what I understand it's something more like Logan's JsonMapper<T> rather than TypeConverter<T>. Only solution I found was to generate static model and then pass it during serialization and parsing. But that's ugly solution because I had to expose internal AutoValue_ class. It seems only solution would be to write custom JsonMapper<T> class but maybe i'm missing something here. Also wouldn't it be just redoing LoganSquare's job?

@ppiech
Copy link

ppiech commented Feb 22, 2017

I'm making an auto-value extension based on auto-value-gson to use LoganSquare. It replaces the parser but uses the core for annotations, type converters and mapper registry.

So far I've run into two problems:

  1. The JsonField annotation can only be applied to fields, which means that I cannot use it for auto-value object's abstract property methods.
  2. The generated JsonObjectMapper object does not conform to the naming convention needed to have it picked up by the LoganSquare.getMapper() call.

Both of these could be addressed pretty easily. Is there still interest in adding this support?

@mannodermaus
Copy link
Contributor

Personally, I would really appreciate having support for AutoValue types while still being able to use LoganSquare. I've tried the same efforts once before as well, but I eventually gave up on trying to integrate the existing parser with AutoValue's concepts, rather than replacing it.

@LuigiPapino
Copy link

I found this googling: https://github.com/yongjhih/AutoJson
It seems well written

@fullkomnun
Copy link

@ppiech did you manage to get LoganSquare working with Auto-Value?

@ppiech
Copy link

ppiech commented Jun 5, 2017

@restor1
Yes! But then decided not to use it. I forked auto-value-gson and logan-square and mashed them together into a single project: https://github.com/ppiech/auto-value-jackson. It works, but it doesn't support generics.

@krobert
Copy link

krobert commented Dec 5, 2018

Hi, its been a while since the last comment, any updates on this matter?
Will this be supported or any usefull extensions to make this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants