Questions tagged [xtend]

Xtend is a statically typed programming language that transcompiles to Java. It aims to produce more readable code than traditional Java.

Xtend is a programming language that transcompiles to Java. It aims to produce more readable code than traditional Java by reducing the amount of boilerplate code. It is developed by the Eclipse foundation.

415 questions
1
vote
1 answer

Xtend: declare empty map as return statement

In an overridden method I'd like to return an empty map. How I'm trying to make it work: override myMethod() { #{} // cannot convert from Map to Map } And what is working for me but not so "Xtend-ish": override…
Adam Horvath
  • 1,249
  • 1
  • 10
  • 25
1
vote
2 answers

Combining Sets in xtend

I have two sets: val Set setA = #{1, 2, 3} val Set setB = #{3, 4, 5} + setA I would expect setB to contain 1, 2, 3, 4, 5. However, the + operator returns an instance of Iterable, instead of a Set. Are there any xtend shortcuts…
wheeler
  • 2,823
  • 3
  • 27
  • 43
1
vote
1 answer

Guice: Using injected class as local variable in default constructor

I have a Java class in a xtend file that uses Guice, like this: class myClass { @Inject private extension classA @Inject private extension classB // methods // ... } I want to add an integer field and modify the default constructor to set…
Renoa
  • 385
  • 1
  • 4
  • 10
1
vote
1 answer

How to filter identical named attributes of classes

With a Xtend file, I am generating a hpp file including attributes of inputed object classes. The following code snippet writes all attributes related to the classes. «FOR o : myClass.objectClasses» Test::ObjectClassHandle…
1
vote
1 answer

Calling from Xtend to Java with multi-dimensional array parameters

I need to call a Java method from Xtend that expects a two dimensional array such as: javafunc (String [][] {{"0","1"}.{"2","3"}}) My initial thought is to write a Java static method that accepts a List of arrays, converts it to a two dimensional…
Jonathan
  • 2,635
  • 3
  • 30
  • 49
1
vote
1 answer

Xtend: add indentation to template

I want to create a template that's indented 4 spaces, like below: def myMethod() ''' for (int i =0; i!= size; ++i) { doSomething(); } ''' But Xtend removes the 4 spaces before the for() and the closing '}'. How can I…
Adam Horvath
  • 1,249
  • 1
  • 10
  • 25
1
vote
1 answer

Xtend - pop-off last character from template

I'm using Xtend template to generate list and I would like to pop-off the last comma from the generated sequence: «FOR link : links» «link.simpleName», «ENDFOR» Can I manipulate the StringConcatenation behind "on-the-fly"? «ENDFOR…
Adam Horvath
  • 1,249
  • 1
  • 10
  • 25
1
vote
1 answer

How can I generate in Xtext with the the Xtend Generator code as it was written?

I have this grammar defined in Xtext and when generating code with Xtend I want to get the Selection Expression as it was written. So that when a selection expression like x = "abc" || (y="pqr" && z = "lmn") is written with that grammar, the…
user151387
  • 103
  • 7
1
vote
1 answer

Generating Java code using Xtend and Sirius

So, my aim is to create graphical DSL. I created a ecore model using Eclipse Modeling Framework, after that I've used Sirius to create graphical modeling tool and I have problems with the last step which is generating Java code. I would like to use…
user777
  • 83
  • 7
1
vote
1 answer

How to access instance variable of Java in DSL?

I have a data model(Car.java), source template(dsl file) and application program. Template Class Car.java public class Car { public String name; public int price; public Car() { } } Template file index.template …
user5158149
1
vote
1 answer

Define the generator code location using gradle to build xtext and xtend

I'm trying to create a first project using xText and xTend building with gradle. I created the grammar following the guidance in the xText documentation and also created the xtend generators. In eclipse the code generates to src-gen folder as…
Hugo Dias
  • 341
  • 3
  • 13
1
vote
0 answers

Parsing URL parameter in Vaadin application

I apologize for this very open question, but I did already lots of Research/test, and I can't figure out, so just thought that someone maybe already experimented the same behavior. I have an URL as follow:…
hublo
  • 1,010
  • 2
  • 12
  • 33
1
vote
1 answer

Is it possible to set auto-activation triggers for Xtend and other Xtext-generated languages?

In Eclipse, we can trigger Content-Assist automatically for Java for a given of characters, but I noticed that there is no such option in the Xtext generated languages or Xtend. Is it possible to set auto-activation triggers for these languages…
Hristo Vrigazov
  • 1,357
  • 2
  • 12
  • 20
1
vote
1 answer

How do I include Xtext generator in my Maven project?

I am currently building a framework which would benefit from having a DSL for creating a configuration file, so I created one using Xtext. Now I want to add a dependency to the classes that I have created so that I can generate configurations at…
Hristo Vrigazov
  • 1,357
  • 2
  • 12
  • 20
1
vote
1 answer

how to indent for tab space after writing a statement

How to get a tab space for beautification after writing a statement in Xtext. Here is my code is in Xtext grammar : Block: '_block' name=ID '_endblock' ; and UI template is override complete_BLOCK(EObject model,…
Chaitanya
  • 11
  • 6