Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to adapt the code generation(Hot adapt the automatically generated code)
How to adapt the code generation [message #1790164] Wed, 06 June 2018 10:59 Go to next message
Michael Moser is currently offline Michael MoserFriend
Messages: 33
Registered: October 2012
Location: Zürich, Switzerland
Member
Due to company style guide changes I need to adapt the Java code that gets generated when e.g. selecting Source => Generate hashCode() and equals()

Where are the templates based on which Eclipse generates such source code?
Is there some intro or documentation for these? I googled extensively but there aren't very many hits any more on Eclipse-related subjects.

I hope you don't tell me that this is hardcoded...

Re: How to adapt the code generation [message #1790379 is a reply to message #1790164] Fri, 08 June 2018 20:45 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1651
Registered: July 2009
Senior Member
Have a look at http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui/core%20extension/org/eclipse/jdt/internal/corext/codemanipulation/GenerateHashCodeEqualsOperation.java

If you see the kind of logic in that class it should become clear that this needs to be programmed, not "templated".
Feel free to roll your own generator based on this class, though.
Re: How to adapt the code generation [message #1790400 is a reply to message #1790379] Sat, 09 June 2018 10:49 Go to previous message
Michael Moser is currently offline Michael MoserFriend
Messages: 33
Registered: October 2012
Location: Zürich, Switzerland
Member
Ouch! That's what I had feared! I'll have to have a closer look to see whether I really want to delve into that business...
Many thanks for the pointer, anyway!
Previous Topic:Eclipse autocomplete does not show the correct parameter-names
Next Topic:JDT parser problems with finding declaration and references
Goto Forum:
  


Current Time: Mon Nov 19 17:19:35 GMT 2018

Powered by FUDForum. Page generated in 0.02776 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top