Refactor on Jaxb rename/move

Answered

Hello,

Some of our classes get generated by jaxb from a schema.

Whenever one of those classes changes name (or is moved to a different package), we end up having to manually rename a gazillion imports, type references and field names in our own code.

Is there a way to use IntelliJ's refactoring features when a class' (file) name or location has changed, to get all references in our source code updated painlessly?

Brgrds,

Christian

3 comments
Comment actions Permalink

Refactoring works automatically for the folders that are configured as sources, test sources or generated sources. Make sure the generated java files are under one of the source roots.

0
Comment actions Permalink

Serge, I think the point is that the _schema_ is changed and the generated classes change automatically due to that.

I don't think IDEA can handle that.

0
Comment actions Permalink

Ah, if the change to the class/name is external (due to the schema changes), IDEA cannot handle it. One can refactor beforehand knowing the new class name/location, and then generate the code.

0

Please sign in to leave a comment.