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 Fri, 14 Jun 2019 12:02:00 GMT

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

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

[~jinahya] the setter is needed to map from json to the object (jsonb.fromJson), previous
code works without the setter if you remove the fromJson call. The spec says public fields
are managed if I recall correctly or it has accessors.

> 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