Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Getter for annotated Operations?
Getter for annotated Operations? [message #1014889] Tue, 26 February 2013 16:53 Go to next message
Bernhard Hoisl is currently offline Bernhard Hoisl
Messages: 26
Registered: March 2011
Junior Member
Hi community,

exists a getter method for operations that returns a list of annotations defined?

For example:

@color red, blue
operation test() {
return self.getAnnotations();
}

Should return something like:
[color] => [red,blue]

Or is there a way to get all operations from one EOL module annotated with the same name for grouping purposes?

Thanks for the help!

-Bernhard
Re: Getter for annotated Operations? [message #1014957 is a reply to message #1014889] Tue, 26 February 2013 23:01 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 862
Registered: July 2009
Senior Member
Hi Bernhard,

You can use EolAnnotationsUtil to retrieve the values of operation annotations. See the isCached() method of [1] for an example.

Cheers,
Dimitris

[1] http://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/trunk/plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/EolOperation.java
Re: Getter for annotated Operations? [message #1015054 is a reply to message #1014957] Wed, 27 February 2013 10:08 Go to previous messageGo to next message
Bernhard Hoisl is currently offline Bernhard Hoisl
Messages: 26
Registered: March 2011
Junior Member
Hi Dimitris,

thanks for the quick reply. I assume there is no way to retrieve annotations and their values within an Epsilon script? Because I wondered for which purpose I can annotate an operation with random annotations (like @color)? Is there any behaviour implemented for annotations beside the reserved keywords (like @test, @template etc.)?

-Bernhard
Re: Getter for annotated Operations? [message #1015510 is a reply to message #1015054] Fri, 01 March 2013 00:45 Go to previous message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 862
Registered: July 2009
Senior Member
Hi Bernhard,

In Epsilon annotations are mainly used for syntax-preserving language extensions so querying them at runtime from within Epsilon programs is not supported out-of-the-box. Of course, you could always implement a Java tool [1, 2] that does this.

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/call-java-from-epsilon/
[2] http://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/trunk/examples/org.eclipse.epsilon.examples.tools/src/org/eclipse/epsilon/examples/tools/SampleTool.java
Previous Topic:Cannot integrate evl with emf tree-editor
Next Topic:Validation after Transformation
Goto Forum:
  


Current Time: Tue Sep 16 19:38:53 GMT 2014

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

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