|
|
Re: ValidateTestHelper.asserError arguments [message #1753648 is a reply to message #1753312] |
Wed, 08 February 2017 13:15 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
In Xtext, an EClass is the type of an element in your AST. The 'E' stands for Ecore, which offers a bit higher-level description of types than Java.
If you use a generated Ecore model (that's the default), the EClasses are defined by the rules in your grammar, e.g.
grammar ...
generate myEcore "http:..." // will result in an EPackage 'myEcore'
Foo: // will result in an EClass 'Foo'
'foo' name=ID; // will result in an EAttribute 'name'
Will result in an EClass 'Foo' with and EAttribute 'name' of type 'EString'.
Once you run the workflow, the code generator will derive an Ecore model with the EClasses from your grammar. Then it will run the EMF code generator to generate Java classes from the Ecore model.
If you need to access an EClass, e.g. to pass it to the ValidationTestHelper, you find it as a singleton in the generated EPackage class. In our case
MyEcorePackage.eINSTANCE.getFoo()
or
MyEcorePackage.Literals.FOO
If you have an element of the AST in your hands, use
myObject.eClass()
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
Powered by
FUDForum. Page generated in 0.04307 seconds