johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JOHNZON-213) Make @JsonbTypeAdapter works with accessors
Date Sat, 15 Jun 2019 17:35:00 GMT

    [ https://issues.apache.org/jira/browse/JOHNZON-213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16864800#comment-16864800
] 

Romain Manni-Bucau commented on JOHNZON-213:
--------------------------------------------

The rule are the following ones: any value with a reader is serialized, any value with a writer
is deserialized. A reader is either a field or a getter, a writer is either a field or a setter.
Priority is standard one (method over field). Field must be public or are ignored. JsonbProperty
is never needed except to change default key. JsonbTransient is about serialization only,
not deserialization. About adapter or serializer/deserializer it is the same, the reader or
writer must host it, for field it is the same but for methods it can differ.

> Make @JsonbTypeAdapter works with accessors
> -------------------------------------------
>
>                 Key: JOHNZON-213
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-213
>             Project: Johnzon
>          Issue Type: Bug
>          Components: JSON-B
>    Affects Versions: 1.1.12
>            Reporter: Jin Kwon
>            Priority: Major
>
> For some reasons, I need to annotate an overridden method with an {{@JsonbTypeAdapter}}.
> {code:java}
> class Parent<T extends ...> {
>     T options;
> }
> class Child extends Parent<SomeOptions> {
>     @JsonbTypeAdapter(value = SomeOptionsTypeAdapter.class)
>     public SomeOptions getOptions() {
>         return super.getOptions();
>     } 
> }
> {code}
> Now Johnzon complains.
> {code}
> javax.json.bind.JsonbException: Missing a Converter for type class ...Params$Options
to convert the JSON String '{"..."}' . Please register a custom converter for it.
> Caused by: org.apache.johnzon.mapper.MapperException: Missing a Converter for type class
...Params$Options to convert the JSON String '{"..."}' . Please register a custom converter
for it.
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message