how to generate jakarta imports in version 0.5.1
carl-don-it opened this issue · comments
my project use version 0.5.1, and we need to upgrade the javax to jakarta, but we use a very complicated rulefactory and i don't want to upgrade the version, do you have any better solution? btw, where can i get the rulefactory reference
Hi
As you're using "complicated rulefactory" (assuming it's a custom rulefactory), one option could be changing it to use custom rules (extend rules that add javax.*
) in such way that logic will be overridden to generate jakarta.*
instead.
Other possibilities could be:
- applying some transformation plugin (ie. smht. like rewrite-maven-plugin perhaps) such that it would transform generated
*.java
files by replacingjavax.*
tojakarta.*
. - switching to using forked version of
jsonschema2pojo
patching it to suite the needs
btw, where can i get the rulefactory reference
Not sure what is meant by that
thanks, applying some transformation plugin would be easier,.
i mean is there any document that can guide me to write a rulefactory and explain how it works?
is there any document that can guide me to write a rulefactory and explain how it works?
I don't think that there is any official document.
However I've pointed out several times and other people have posted examples on how to do that, see for example given comment.
TLDR:
- create a class that extends
RuleFactory
- override methods that return rule(s) of interest to you to return custom (class extends *Rule) rule(s) which would have logic that suits your needs
- make sure that custom rule factory class as well as custom rules and all needed stuff is on class path during jsonschema2pojo execution
- point jsonschema2pojo at your custom rulefactory via configuration property eg.