2

For a project I'm working on, I send queries to StackExchange and transform the JSON result into POJOs using jsonschema2pojo maven plugin. The problem is quite simple : that plugin always name the wrapper class Data and its contained data Item, when I would like wrapper to be named *Wrapper and the contained class Answer for a call to the answers endpoint (as an example).

Well, anyway, how could I rename the Data class to AnswerWrapper and the Item class to Answer ? I know the folder they're in, the package used to define, and so on. The only missing thing is a tool/plugin/java application to perform that operation. I was directed to JRefactory, but the downloaded JAR doesn't look like it can provide the operation I want (and its lack of doc makes it unusable).

So, is there any more modern/efficient solution ? (or at least some I could integrate in my maven build) ?

Community
  • 1
  • 1
Riduidel
  • 22,052
  • 14
  • 85
  • 185

1 Answers1

1

Maybe not the easiest solution but one that would fit nicely with your requirements would be to actually add functionality to the maven plugin to support customizing the names of the generated classes. It would of course include building your own version and maybe submitting a patch to get it included in the mainline.

K Erlandsson
  • 13,408
  • 6
  • 51
  • 67