Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [JET2] Generating multiple files from an input model
[JET2] Generating multiple files from an input model [message #29338] Fri, 27 July 2007 07:41 Go to next message
Joaquin  Cañadas is currently offline Joaquin Cañadas
Messages: 25
Registered: July 2009
Junior Member
Hello,
I need to generate multiple files from an input model, one for each
"concept" in the input model. For example, my input model is as follows:

<?xml version="1.0" encoding="ASCII"?>
<KnowledgeModel name="MyKM">
<concepts name="Person">
<attributes name="firstName"/>
<attributes name="address"/>
</concepts>
<concepts name="Product">
<attributes name="code"/>
<attributes name="productName"/>
</concepts>
</KnowledgeModel>

I would like to generate several files (*.java), one for each concept in
the input model (Person.java, Product.java, and so on). The main.jet
template use a <ws:file ...> tag to set the target file, but, it is
possible to set the target file dynamically when the input model is
being processed? I mean, something like that:

<c:iterate select="/KnowledgeModel/concepts" var="curConcept">
<%-- name of target file:
<c:get select="$curConcept/@name"/> + ".java" --%>
<%-- I pseudocoded "+" as a concatenation operation --%>
<%-- create the target file --%>
<%-- write code in the target file --%>
</c:iterate>

Thank you
Joaquín
Re: [JET2] Generating multiple files from an input model [message #29376 is a reply to message #29338] Fri, 27 July 2007 08:06 Go to previous message
Joaquin  Cañadas is currently offline Joaquin Cañadas
Messages: 25
Registered: July 2009
Junior Member
Hello again,
my problem is perfectly explained in the tutorial Create more -- better
-- code in Eclipse with JET:
http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/

Sorry !
Joaquín

Joaquín Cañadas escribió:
> Hello,
> I need to generate multiple files from an input model, one for each
> "concept" in the input model. For example, my input model is as follows:
>
> <?xml version="1.0" encoding="ASCII"?>
> <KnowledgeModel name="MyKM">
> <concepts name="Person">
> <attributes name="firstName"/>
> <attributes name="address"/>
> </concepts>
> <concepts name="Product">
> <attributes name="code"/>
> <attributes name="productName"/>
> </concepts>
> </KnowledgeModel>
>
> I would like to generate several files (*.java), one for each concept in
> the input model (Person.java, Product.java, and so on). The main.jet
> template use a <ws:file ...> tag to set the target file, but, it is
> possible to set the target file dynamically when the input model is
> being processed? I mean, something like that:
>
> <c:iterate select="/KnowledgeModel/concepts" var="curConcept">
> <%-- name of target file:
> <c:get select="$curConcept/@name"/> + ".java" --%>
> <%-- I pseudocoded "+" as a concatenation operation --%>
> <%-- create the target file --%>
> <%-- write code in the target file --%>
> </c:iterate>
>
> Thank you
> Joaquín
Previous Topic:Passing Java objects by reference
Next Topic:Re: oaW
Goto Forum:
  


Current Time: Sun Apr 20 06:54:41 EDT 2014

Powered by FUDForum. Page generated in 0.01749 seconds