Skip to main content


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 11:41 Go to next message
Joaquin  Cañadas is currently offline Joaquin CañadasFriend
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 12:06 Go to previous message
Joaquin  Cañadas is currently offline Joaquin CañadasFriend
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: Sat Apr 20 01:46:23 GMT 2024

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

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

Back to the top