[ 
https://issues.apache.org/jira/browse/WINK-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927014#action_12927014
 ] 

Bryant Luk commented on WINK-325:
---------------------------------

Which version of Jackson are you using?

In unit tests with Jackson 1.5.5 and 1.6.0:

{code}
        ObjectMapper mapper = new ObjectMapper();
        
mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);
        AnnotationIntrospector pair =
            new AnnotationIntrospector.Pair(new JaxbAnnotationIntrospector(),
                                            new 
JacksonAnnotationIntrospector());
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
        JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
        jacksonProvider.setMapper(mapper);
        AtomText a = new AtomText("hello");
        jacksonProvider.writeTo(a, a.getClass(), a.getClass(), new 
Annotation[0], MediaType.APPLICATION_JSON_TYPE, null, System.out);
{code}

would return:

{code}
{"otherAttributes":{},"type":"text"}
{code}

If instead, I remove the (de)serialization config, I get:

{code}
        ObjectMapper mapper = new ObjectMapper();
        
mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);
        JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
        jacksonProvider.setMapper(mapper);
        AtomText a = new AtomText("hello");
        jacksonProvider.writeTo(a, a.getClass(), a.getClass(), new 
Annotation[0], MediaType.APPLICATION_JSON_TYPE, null, System.out);
{code}

{code}
{"value":"hello","type":"text","otherAttributes":{}}
{code}

> Allow AtomCommonAttributes#otherAttributes and 
> AtomCommonAttributesSimpleContent#otherAttributes to be lazy initialized.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-325
>                 URL: https://issues.apache.org/jira/browse/WINK-325
>             Project: Wink
>          Issue Type: Improvement
>          Components: Common
>    Affects Versions: 1.1.2
>            Reporter: Kaloyan Kolev
>            Priority: Trivial
>             Fix For: 1.1.2
>
>
> I am using the Jackson provider to serialize an AtomText which extends 
> AtomCommonAttributes. 
> For as simple input as:
> {code}
> return new AtomText("someValue");
> {code}
> I get:
> {code}
> {
>   "otherAttributes" : {
>   },
>   "type" : "text",
>   "value" : "someValue"
> }
> {code}
> AtomCommonAttributes#otherAttributes is accessed as in the rest of the Atom* 
> beans. Is it possible to allow the map to be lazily initialized when the 
> AtomCommonAttributes#getOtherAttributes() method is called like in the rest?
> I can see this is also relevant for the AtomCommonAttributesSimpleContent 
> class, so updating the summary.
> Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to