java - Jackson conflicting property and getter definitions -


i'm extending following third-party class can't change:

public class page {     @jsonproperty("content")     private string content;      public string getcontent() {}; } 

my implementation of page looks this:

public class mypage extends page {     @jsonproperty("my-content")     public string getcontent() {return super.getcontent()}; } 

when i'm trying serialize instance of mypage class following exception:

java.lang.illegalstateexception: conflicting property name definitions:   'content' (for [field com.test.page#content])  vs 'my-content' (for [method com.test.mypage#getcontent(0 params)]) 

is there easy way force serializer produce 'my-content' property?

i guess issue solved in jackson 2.4.0. please check https://github.com/fasterxml/jackson-databind/issues/193.

try update jackson library 2.4.0 or above.


Comments