Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Re: [Acceleo] Arguments list in Generator-API
Re: [Acceleo] Arguments list in Generator-API [message #498710] Wed, 18 November 2009 09:43
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1901
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi Timothy,

Please use the m2t forum (added to the cc list of this reply) for
questions on Acceleo.

As for your question; "the Accelo.doGenerate-API [...] what can be
passed as arguments? [...] what should be passed within this list" ...
arguments to what? Which list?

I can see only one "doGenerate(...)" method in the AcceleoService class
(hope this is what you meant by "Acceleo") that takes a "List" as
parameter : "public Map<String, String> doGenerate(Module, String,
EObject, List<? extends Object>, File, Monitor)", I'll assume you were
talking about that one. Though if the javadoc

This is a convenience method that can be used with multiple argument
templates. The input model will be iterated over for objects matching
the template's <b>first</b> parameter type. The template will then be
called with these objects as first arguments, and the given list of
<code>arguments</code> for the remaining template parameters.
@param arguments
Arguments of the template call, excluding the very first one
(<code>model</code> object).

doesn't help you, I don't really know how I can. For example, if your
template is defined as

[module MyModule(...)/]

[template generate(c : EClass, s : String)]

Then to call this template on all "EClass"es of model "myModel.ecore"
with argument "s" equal to "testString" you have to call
AcceleoService.doGenerate(...) as :

File generationRoot = new File("project/src-gen");
Module myModule = ...;
String templateName = "generate";
EObject model = ModelUtils.load("myModel.ecore");
List<Object> args = new ArrayList<Object>();

AcceleoService.doGenerate(myModule, "generate", model, args,
generationRoot, new BasicMonitor());

Laurent Goubet

Timothy Marc wrote:
> Hi all,
> i successfully started some transformations via the
> Accelo.doGenerate-API. It is very convenient and intuitive, so far. But
> what can be passed as arguments?! I tried to understand by browsing the
> code, but i didn't get a clue, what should be passed within this list.
> I would appreciated any hint.
> Thanks Timothy

Content-Type: text/x-vcard; charset=utf-8;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;

fn:Laurent Goubet
org:<a href="">Obeo</a>

Previous Topic:XSDMetaModel
Next Topic:[acceleo]Access to java code and properties from scripts
Goto Forum:

Current Time: Thu Dec 08 04:17:43 GMT 2022

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

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

Back to the top