Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [XBase] Find JvmType for specific class name?
[XBase] Find JvmType for specific class name? [message #1061639] Mon, 03 June 2013 07:41 Go to next message
Alan DW is currently offline Alan DW
Messages: 103
Registered: March 2012
Senior Member
Hello everyone,

I'm working on an XBase project and I need to compose the AST of an XExpression (in the JvmModelInferrer of course). This works very well by using XBaseFactory and the setters&getters of the expression classes, but now I'm at the point where I need to call a constructor to a JvmType. The problem is that all I know from this JvmType is its qualified name (as in: Java qualified name, e.g. "java.lang.RuntimeException"). The question is: how can I find or create the JvmType instance for a given qualified name? I've searched through various tutorials and info pages and the javadoc page of the XExpression and its subclasses, but I didn't find anything that suits this particular need.


Thanks,


Alan
Re: [XBase] Find JvmType for specific class name? [message #1061739 is a reply to message #1061639] Mon, 03 June 2013 13:00 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard Traetteberg
Messages: 594
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 03.06.13 04.41, Alan DW wrote:
> Hello everyone,
>
> I'm working on an XBase project and I need to compose the AST of an
> XExpression (in the JvmModelInferrer of course). This works very well by
> using XBaseFactory and the setters&getters of the expression classes,
> but now I'm at the point where I need to call a constructor to a
> JvmType. The problem is that all I know from this JvmType is its
> qualified name (as in: Java qualified name, e.g.
> "java.lang.RuntimeException"). The question is: how can I find or create
> the JvmType instance for a given qualified name? I've searched through
> various tutorials and info pages and the javadoc page of the XExpression
> and its subclasses, but I didn't find anything that suits this
> particular need.

I use the following

@Inject extension TypeReferences
@Inject extension JvmTypesBuilder

They provide both lookup of JvmTypes and creating JvmTypeReferences

Hallvard
Re: [XBase] Find JvmType for specific class name? [message #1061885 is a reply to message #1061739] Tue, 04 June 2013 10:10 Go to previous message
Alan DW is currently offline Alan DW
Messages: 103
Registered: March 2012
Senior Member
Hello Hallvard,

thank you for your answer! The "TypeReferences" class looks just like what I need, judging by its Javadoc. I'll give it a try Smile

Thanks a lot!


Alan
Previous Topic:Avoid outline refresh while editing file
Next Topic:Standalone generator & models in multiple jars
Goto Forum:
  


Current Time: Fri Aug 01 01:58:09 EDT 2014

Powered by FUDForum. Page generated in 0.02855 seconds