XTEXT How to add data to grammar [message #1467614] |
Mon, 10 November 2014 06:54 |
chris yo Messages: 146 Registered: February 2013 |
Senior Member |
|
|
Let's say I have a grammar that reads all the names of the employees.
Model:
def +=employees*
;
employees:
'Employee' 'Name' '=' name=ID
'Employee' 'ID' '=' emp_id=ID
;
In my code, I want to add by default some existing employees already. Like the president, vp, etc. So I have an array of employees, declared like this:
val aEmployees = new ArrayList<employees>()
This variables contains all the configured employee names by the user. I add the configured names during the transform section.
But, when I tried to add manually a static code,
val emp = new employees()
emp.setName("chris")
emp.setEmp_id("xx123");
I am getting an error since employees is only an interface.
What are the ways to add it manually?
[Updated on: Mon, 10 November 2014 06:56] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01501 seconds