Search code examples
javajsonjacksonmixinspojo

Jackson Mixin for Class having a List of same Class


I have a class

public class Rectangle
{
  int a;
  int b;
  List<Rectangle> c;
}

I want to use Jackson mixin for this class to modify the Rectangle class using Jackson annotations. Will using below code for List will work?

 @JsonProperty("c")
 abstract List<Rectangle> getC();

Any help will be appreciated.


Solution

  • As per the suggestion by @Henrik and @zeppelin. I tried out the code and it works fine having a List of same class objects when using Jackson mixin.