wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes code generation tool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "code generation tool" Watch "code generation tool" New topic

code generation tool

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
Hi, recently I am working on a code generation tool.

I have a description file, say, properties file,

I generate method skeleton, programmer could add details into it.

Now, the problem is coming in. If I add one more new method to properties file, generate coding, it will overwrite/delete the method detail added by programmer, how could I avoid this? I want to insert a new method signature into that file.

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Generate a class with abstract methods out of the code generator. Developers never touch this code because it will all be replaced by the next gen. You could even generate compiled classes into a jar and never let them see the source.

Instead developers extend the abstract class and override all the required methods. If a new gen adds a method, the next time they open up the concrete class the IDE or compiler will complain that there are missing methods. It's nice to have the tools working for you instead of against you!

Is that something you can do?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
BTW: Look into the XMI standard for expressing UML models in XML. You might be able to model your objects in a graphical UML tool, export XMI and then generate your code from there. Our code generator is actually an XSL style sheet working XMI simplified (by a proprietary tool) into a more easily consumed XML grammar. Add "visual modeling" and "standards" to your sales literature!
I agree. Here's the link: http://aspose.com/file-tools
subject: code generation tool
Similar Threads
pointcut for method in parent abstract class
Problem with method between classes
generate AXIS server-config.wsdd ?
Is there a tool which generates JUnit-test stubs?
log file name with timestamp