Open ZakTaccardi opened 8 years ago
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.
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?
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?
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.
I found this googling: https://github.com/yongjhih/AutoJson It seems well written
@ppiech did you manage to get LoganSquare working with Auto-Value?
@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.
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?
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/