But the Immutables support is quite easy - you need to recognize
@JsonDeserialize with builder attribute on a class level. All other
annotations used by Immutables your project is already supported (look
like).
e.g. in
the gwt-jackson (com.github.nmorel.gwtjackson.rebind.bean.BeanProcessor)
```java
// Look for a builder class
Optional<Annotation> jsonDeserialize = CreatorUtils.getAnnotation(
"com.fasterxml.jackson.databind.annotation.JsonDeserialize", accessors );
if (jsonDeserialize.isPresent()) {
Optional<JClassType> builderClass =
typeOracle.getClassFromJsonDeserializeAnnotation( logger,
jsonDeserialize.get(), "builder" );
if (builderClass.isPresent()) {
builder.setBuilder( builderClass.get() );
return;
}
}
```
Best,
Stas
On Wednesday, April 3, 2019 at 9:08:35 PM UTC+2, Ahmad Bawaneh wrote:
>
> Thanks , this is exactly what i need to know, i am adding support for
> annotations incrementally.
>
> On Wednesday, April 3, 2019 at 10:24:30 AM UTC+3, foal wrote:
>>
>> Hi,
>>
>>
>> A relatively simple project is on Bitbucket:
>> https://bitbucket.org/JRS/open-gavka (hg) or mirror on GitHub (git):
>> https://github.com/jresearchsoftware/open-gavka .
>>
>> BTW I have looked on gwt-jackosn-apt but didn't try because of lack
>> support for the Jackson annotations comparing with classic gwt-jackosn
>> project (at least for @JsonDeserialize).
>>
>> Best,
>> Stas
>>
>>
>> On Tuesday, April 2, 2019 at 9:09:00 PM UTC+2, Ahmad Bawaneh wrote:
>>>
>>> Do you have a simple sample project, i would like to see if what is
>>> needed to make this also works with gwt-jackosn-apt.
>>>
>>> On Tuesday, April 2, 2019 at 10:03:28 PM UTC+3, foal wrote:
>>>>
>>>> Hi,
>>>>
>>>> Spent several hours to make workable Immutables (
>>>> https://immutables.github.io) objects with RestyGWT and gwt-jackson.
>>>> Default approach with
>>>>
>>>> @JsonSerialize(as = ImmutableVal.class)
>>>> @JsonDeserialize(as = ImmutableVal.class)
>>>>
>>>>
>>>> doesn't works (gwt-jackson ignore @JsonDeserialize "as" attribute on
>>>> class level) but after looking into the source code I realize that
>>>> "builder" attribute is supported and works. So variant with
>>>>
>>>> @Value.Style(builder = "new") // builder has to have constructor
>>>> @JsonDeserialize(builder = ImmutableVal.Builder.class)
>>>>
>>>>
>>>> works.
>>>>
>>>> Hope it will save somebody several hours of investigation :)
>>>>
>>>> Best,
>>>> Stas
>>>>
>>>>
>>>>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.