How to use generator arguments in my template?

371 Views Asked by At

The 3rd parameter of the generator is a list of arguments.

The documentations says:

If the template which will be called requires more than one argument taken from the model, pass them here.

But how to use this arguments in my template? How to access them?

Ralph

1

There are 1 best solutions below

2
On

Okay I found it... with try and error but not in the documentation :-(

I added one argument to the generator like this:

final List<String> generatorargs = new ArrayList<String>();
generatorargs.add("foo bar");

final DatabaseGenerator generator = new DatabaseGenerator(db, out, generatorargs);
generator.doGenerate(basicMonitor);

And now I can access it like this:

[template public generateElement(aDatabase : Database, foo : String)]

aDatabase is the model and foo is the variable wich contains the 1st argument.

Ralph