Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Accessing java annotations using Xtext/XBase(Accessing java annotations using Xtext/XBase)
Accessing java annotations using Xtext/XBase [message #1743596] Fri, 16 September 2016 17:31 Go to next message
Sonia Ravindran is currently offline Sonia RavindranFriend
Messages: 16
Registered: June 2016
Junior Member
Along with my Xtext/XBase DSLs, i have Java classes which can be accessed by my DSL's XExpression.
The methods of my java classes are annotated using Java Annotations.
How can I find out the list of java classes available and its methods along with its respective annotations from Xtext.
Say, I used a generator where i need to print out the classes , methods in the classes with their annotations in a text file.How can I do this?

when i use this below code fragment , it was not printing me the java files as URIs.
But some how Xtext/XBase has the data indexed.

@Inject IContainer.Manager manager
 
def void printVisibleResources(Resource resource, IResourceDescriptions index) {
    val descr = index.getResourceDescription(resource.URI)
    for (visibleContainer : manager.getVisibleContainers(descr, index)) {
        for (visibleResourceDesc : visibleContainer.resourceDescriptions) {
            println(visibleResourceDesc.URI)
        }
    }
}
Re: Accessing java annotations using Xtext/XBase [message #1743598 is a reply to message #1743596] Fri, 16 September 2016 17:51 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
Hi,

this is not generally possible.

have a look at the classes IJvmTypeProvider - that does name lookup

and ITypesProposalProvider that is used for proposals


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Using Xtext as a textual concrete syntax tool
Next Topic:How does the until rule works ?
Goto Forum:
  


Current Time: Mon Apr 19 10:35:20 GMT 2021

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

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

Back to the top