Live templates that involve an object's methods?

Answered

So I'm hoping there's an easy way to do this.  Writing some methods that are the "Update" portion of a CRUD app.  They have to be done manually, since not all of the fields are updated every time, but would like to save some typing.

 

 

For instance, there's a POJO called Office, with typical office parameters.

 

give the input of oldOffice and updatedOffice, I was hoping there was a way for the system to jump in, see all the parameters that exist on Office, and spit out something like:

oldOffice.setAddress1(updatedOffice.getAddress1());
oldOffice.setAddress2(updatedOffice.getAddress2());
oldOffice.setAddress3(updatedOffice.getAddress3());
oldOffice.setCity(updatedOffice.getCity());
oldOffice.setName(updatedOffice.getName());
oldOffice.setState(updatedOffice.getState());
oldOffice.setZip(updatedOffice.getZip());

 

Is that possible?  

0
2 comments

This looks like a poor code, you may need to consider redesigning your app so that you don't have to do it manually or via a tool.

https://stackoverflow.com/a/4395045/104891 may be a better way.

0

There's no out of the box way to achieve this currently. We have a request for that (https://youtrack.jetbrains.com/issue/IDEABKL-6904) which you can vote/watch. I think the fastest solution would be for someone interested to create a simple plugin for that.

0

Please sign in to leave a comment.