Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Mapping to JVM Concepts(Inferring a JVM Model )
Mapping to JVM Concepts [message #756544] Mon, 14 November 2011 09:24 Go to next message
Benoit Lelandais is currently offline Benoit LelandaisFriend
Messages: 19
Registered: November 2011
Junior Member
Hi,

I want to modify the Xtext 'Domain Model' example. My aim is to change the DomainModelJvmModelInferrer for the property mapping : if the property type is java.lang.Float, I would like to force it to java.lang.Double. But the type of java.lang.Double is Class and I need a JvmTypeReference.

The Float class is already mapped by Xtext but I don't know how to retrieve the jvm references on mapped types ?

Moreover, is it possible to force Xtext to map an existing user library in order to retrieve the JvmReferenceTypes on user classes in the infer method ?

Thanks for your answer.
Re: Mapping to JVM Concepts [message #756557 is a reply to message #756544] Mon, 14 November 2011 10:16 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
There is a utility function in JvmTypesBuilder you should use:

org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder.newTypeRef(EObject, Class<?>, JvmTypeReference...)

call it like :

myModelElement.newTypeRef(typeof(Double))
Re: Mapping to JVM Concepts [message #756643 is a reply to message #756557] Mon, 14 November 2011 14:59 Go to previous message
Benoit Lelandais is currently offline Benoit LelandaisFriend
Messages: 19
Registered: November 2011
Junior Member
Thanks for your answer.

It is ok with Double. Now I want to map the property type to the generic type java.util.ArrayList<java.lang.Double> but it does an error in xtend.

Is this possible ?
Previous Topic:Entities extend other entities
Next Topic:Xtend and Charset fun
Goto Forum:
  


Current Time: Tue Apr 07 01:36:47 GMT 2020

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

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

Back to the top