Intellij SSR: how to extract structured information from initializer expressions

42 Views Asked by At

Is there a way to extract into some structured format (JSON, XML, whatever) partial information from a number of constructor calls expressions?

Say we have code like:

public enum Model {
   TOYOTA, 
   FORD
}

public enum Dealership {
   TOYOTA_GRAND_PRIX(Model.TOYOTA, Set.of("LAND-CRUISER", "AVENSIS")),
   FORD_DELUXE(Model.FORD, Set.of("FOCUS"));

   private final Model model;
   private final Set<String> brands;
}

and I would like to get something like

[
 {
  "model": "TOYOTA", 
  "brands": ["LAND-CRUISER", "AVENSIS"]
 }, 
 {
  "model": "FORD", 
  "brands": ["FOCUS"]
 }
]

is there a way to achieve (something like) this, with SSR?

0

There are 0 best solutions below