Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [SOLVED (+ or -)] JET context.getVariable returning AnyTypeImpl(AnyTypeImpl cannot be cast to <my ecore class>)
icon7.gif  [SOLVED (+ or -)] JET context.getVariable returning AnyTypeImpl [message #831929] Thu, 29 March 2012 14:31 Go to next message
daniel conrado is currently offline daniel conradoFriend
Messages: 2
Registered: August 2011
Junior Member
In my template, I have this:

<%@jet imports="mymodel.*"%>
...
<c:iterate select="/Robot/sensors" var="sensor">
<%
Sensor s = (Sensor) context.getVariable("sensor");
...
%>

But I'm getting this error:
java.lang.ClassCastException: org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to mymodel.Sensor

I don't understand. What am I doing wrong?

Best Regards,
Daniel

[Updated on: Sat, 31 March 2012 14:03]

Report message to a moderator

Re: JET context.getVariable returning AnyTypeImpl [message #833450 is a reply to message #831929] Sat, 31 March 2012 14:03 Go to previous message
daniel conrado is currently offline daniel conradoFriend
Messages: 2
Registered: August 2011
Junior Member
I still can't figure out how to access the Sensor object, but I've got a workaround for my problem. Here it is:

Instead of accessing the object, I write the values I want into variables, like this:
<c:setVariable var="sensorName" select="string($sensor/@name)"/>

And access this way:
final String sensorName = (String) context.getVariable("sensorName");

Hope it may be useful.

Thanks for reading.
Cheers,
Daniel
Previous Topic:[XPand] Eliminate Double Entries
Next Topic:[Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo?
Goto Forum:
  


Current Time: Fri Apr 19 22:02:39 GMT 2024

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

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

Back to the top