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: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090709070609070806090301
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

----------8<----------
[...]
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).
[...]
---------->8----------

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

----------8<----------
[module MyModule(...)/]

[template generate(c : EClass, s : String)]
[...]
---------->8----------

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 :

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

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

Laurent Goubet
Obeo

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


--------------090709070609070806090301
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


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


Current Time: Sat Oct 12 04:34:42 GMT 2024

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

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

Back to the top