Java FasterXml(Jackson) Mixins and Inheritance -


there 2 simple calsses

public class { private int propid; public int getpropid(){return this.propid;} } public class b extends {  } 

and 2 mixins

public interface amixin{ @jsonproperty("propida") int getpropid();} public interface bmixin{ @jsonproperty("propidb") int getpropid();}  jsonobjectmapper = new objectmapper(); // register mixin jsonobjectmapper.addmixin(b.class, bmixin.class); jsonobjectmapper.addmixin(a.class, amixin.class); 

the following 2 calls same results:

jsonobjectmapper.writevalue(writer, new a());  jsonobjectmapper.writevalue(writer, new b()); 

but expect propida first , propidb second one.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -