0

I used the RestyGWT's JsonEncoderDecoder interface to encode/decode some objects. Among them there are instances of classes having properties not exposed using getter/setter methods. I tried annotating corresponding properties with org.codehaus.jackson.annotate.JsonProperty. But it's not working, causing error

[ERROR] [jsonsample] - field must not be private: com.mycompany.jsonsample.ItemList.items

com.mycompany.jsonsample.ItemList is the class with property items which has no getter/setter and annotated as said above.

Also is it possible to tell the encoder/decoder to skip some properties?

Naveed S
  • 5,106
  • 4
  • 34
  • 52

1 Answers1

0

Example with private field and annotated constructor, you should provide more info on your problem though.

public abstract class Parent
{    
    @JsonCreator
    public Parent(@JsonProperty("name") String name)
    {
        this.name = name;
    }

    @Override
    public String getName()
    {
        return name;
    }

    private String name;
}
Ronan Quillevere
  • 3,699
  • 1
  • 29
  • 44