File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

code generation tool

 
Edward Chen
Ranch Hand
Posts: 798
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic