The classes in my ecore explorer (all of them, including "PortInfo") are not marked "interface" or "abstract".
The code below rases an editor error on "" saying "cannot instantiate the interface of type PortInfo"
«{var PortInfo P1 ;
P1=new PortInfo;
P1.signal=r.name ;
P1.direction=tRtlPortDirection.PORT_OUT;
P1.signalType=r.typeString;
RegIF.portList.add(P1);
}»
I want the generator.xtend to collect information while generating and at some point add it to a list, that is a reference attribute in the class of the "RegIF" object.
If "PortInfo" is indeed an interface although NOT marked as such in the ecore, I believe I have to create an implementation for it. I did that in a separate xtend file
import ridl2.PortInfo
import ridl2.tRtlPortDirection
class PortInfo1 implements PortInfo{
String signal
String signalType
tRtlPortDirection direction
override getDirection() {
return direction
}
and do this instead in generator.xtend :
«{var PortInfo1 P1 ;
P1=new PortInfo1;
P1.signal=r.name ;
P1.direction=tRtlPortDirection.PORT_OUT;
P1.signalType=r.typeString;
RegIF.portList.add(P1);
}»
Obviously "RegIF.portList.add(P1); " fails miserably because "PortInfo1 " is a wrong class.
The overall question is: How do I make the PortInfo objects in the xtend code so I can add to RegIF.portList (in the same xtend code)
Alternatively, where and how do I add a PortInfo list to the RegIF class without editing generated files.