简体   繁体   中英

How does Eclipse generate code? Like Getters and Setters

I am working on a project to generate some code in Eclipse. I found that CodeModel can generate Java Code for me, but how do I integrate this as a plug-in?

How does Eclipse generate Code? Like getters and setters?

My overall goal would be to generate my own code in Eclipse. Is there any API out there what I could use?

You can use the eclipse JDT libraries for doing code parsing and modifications.

If you are trying to use the same in an eclipse plugin project, you will have to add org.eclipse.jdt.core to the plugin dependencies (in the plugin.xml file).

Check the below posts for more information on parsing the java code and saving the changes back to the code.

You can use generated AspectJ files. To generate this files you can use reflection or some framework like write-it-once .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM