Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Problem with providing variable to template
Problem with providing variable to template [message #839869] Mon, 09 April 2012 10:19 Go to next message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 117
Registered: February 2012
Senior Member
I am trying to add variables (input parameters) to my EGLTemplate:
EglFileGeneratingTemplateFactory factory = new EglFileGeneratingTemplateFactory();
factory.getContext().getFrameStack().put(new Variable("outputLocation", outputLocation, EolPrimitiveType.String));
EglTemplate template = factory.load(getEntry());
template.process();


When I check the type of 'outputLocation' in my egl file (grabbed from getEntry() earlier), its type is unset. This code returns 'Type: ' instead of 'Type: String' (or something similar):
("Type: " + outputLocation.type()).println();


So, obviously my next statement
t.generate(outputLocation);
goes wrong as it expects a String for the location parameter. (Changing it to
t.generate(outputLocation + "");
'solves' my problem)

Is this a bug that I should report, or am I doing something wrong here?
Re: Problem with providing variable to template [message #840002 is a reply to message #839869] Mon, 09 April 2012 14:37 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 886
Registered: July 2009
Senior Member
Hi Maarten,

Thanks for doing this. To speed things up could you perhaps put together a minimal example I can use to reproduce this?

Cheers,
Dimitris
Re: Problem with providing variable to template [message #840038 is a reply to message #840002] Mon, 09 April 2012 15:39 Go to previous message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 117
Registered: February 2012
Senior Member
Hi,

When I created my minimal example it did not fail... Wink

It was my error: outputLocation was an URI instance. So, adding the +"" resulting in a conversion to String.
So by converting it to a string when I created the variable fixed my problem:
factory.getContext().getFrameStack().put(new Variable("outputLocation", outputLocation.toString(), EolPrimitiveType.String));


Thanks for your time.
Cheers,
Maarten

PS Only thing is, that this message could be make clearer:
Method 'generate' not found for: org.eclipse.epsilon.egl.EglFileGeneratingTemplate@2d7cec96 (Driver.egl@6:7)

Maybe by adding the used method parameter types, so the user sees why the method is not found..? (In this case I would have easily seen that I was accidentally using the URI object)
Previous Topic:Inheritance in rules [SOLVED]
Next Topic:[EOL] How are models resolved in eol?
Goto Forum:
  


Current Time: Sat Oct 25 12:43:19 GMT 2014

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

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