You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "A. Bob" <a_...@cheerful.com> on 2002/02/26 20:06:01 UTC

Generating java/c++ code from uml class diagramms

Hello to the velocity community,


I am student and i have been trying in  the last time to write a template based codegenerator using velocity instead of jsp and JavaCC as parser. While i am progressing, i have some questions on some points. Questions because i don't really know how to process or because i have tried without success. Of course i am newbie to all. 

The first question may be:

1) how to ouput the "," after each parameter in a method? I have tried it using ArrayIterator or ListIterator like it may be in java using hasNext() method but it couldn't work. I have tried everything that was possible with my little knowlegde but .-(((

2) The second problem may be:

Is there a way of creating files from the read models of uml class diagramms at runtime inside the template? The problem may be simple for c++ event though it doen't make sense if the file name is not selfexplanatory. In java, the name will not be choosen randomly. 

I have look the java io package/velocity API but couldn't find way the way to solve it.

#foreach($class in $classes)

 #create file $className.java

in this way?

Any help in this directions will be appreciated. 

Sincerely


Peace
-- 

_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generating java/c++ code from uml class diagramms

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/26/02 2:06 PM, "A. Bob" <a_...@cheerful.com> wrote:

> Hello to the velocity community,
> 
> 
> I am student and i have been trying in  the last time to write a template
> based codegenerator using velocity instead of jsp and JavaCC as parser. While
> i am progressing, i have some questions on some points. Questions because i
> don't really know how to process or because i have tried without success. Of
> course i am newbie to all.
> 
> The first question may be:
> 
> 1) how to ouput the "," after each parameter in a method? I have tried it
> using ArrayIterator or ListIterator like it may be in java using hasNext()
> method but it couldn't work. I have tried everything that was possible with my
> little knowlegde but .-(((

Can you give an example of what you are doing?  I don't understand yet where
the problem is - is this in a template?

> 
> 2) The second problem may be:
> 
> Is there a way of creating files from the read models of uml class diagramms
> at runtime inside the template? The problem may be simple for c++ event though
> it doen't make sense if the file name is not selfexplanatory. In java, the
> name will not be choosen randomly.
> 
> I have look the java io package/velocity API but couldn't find way the way to
> solve it.
> 
> #foreach($class in $classes)
> 
> #create file $className.java
> 
> in this way?

Well, you can write a tool, a class that you put into the context, that
writes the output for you to a file.

#foreach($class in $classes)
  $yourtool.open($class.getClassName())
  $yourtool.write(  .... )
#end

> 
> Any help in this directions will be appreciated.
> 
> Sincerely
> 
> 
> Peace

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"We will be judged not by the monuments we build, but by the monuments we
destroy" - Ada Louise Huxtable


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>