Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Getting started
Getting started [message #1715822] Thu, 26 November 2015 12:59 Go to next message
cory mcdee is currently offline cory mcdeeFriend
Messages: 1
Registered: November 2015
Junior Member
Hi all,

I'm new to Xtext, and I'm extending the domainmodel example. It looks really promising.

To get started learning, I've changed the grammar like this:

Property:
    name=ValidID ':' type=JvmTypeReference|ArrayListOfString;

ArrayListOfString:
    name='list';


So in the code, I want to be able to write:

myproperty: list



GOAL: What I want to achieve is for the generated code to replace "list" with "java.util.ArrayList" whenever it's used.

Do I do this in the inferrer? Or do I need to implement ITypeComputer? If the latter, it seems that DomainmodelRuntimeModule no longer offers bindITypeComputer as in the examples I've seen.

I'm using Xtext 2.9 2015117 milestone.


Thanks for helping me get started Very Happy
Re: Getting started [message #1716613 is a reply to message #1715822] Sun, 06 December 2015 11:43 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi you can use "java.util.ArrayList".typeRef("java.lang.String".typeRef) to infer the type of the field to ArrayList<String>

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:dangling reference with models from different files
Next Topic:Missing "org.eclipse.xtext.dependencies:2.9.0" in Central?
Goto Forum:
  


Current Time: Fri Apr 19 19:04:57 GMT 2024

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

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

Back to the top