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
5
votes
1 answer

Combine filter and map in Xtend collections

Given some iterable variable v and a type T I often find myself writing code such as v.filter[it instanceof T].map[it as T] Does there exist some helper which does the same functionality in a single step?
Mathias Soeken
  • 1,293
  • 2
  • 8
  • 22
5
votes
2 answers

create comma-separated list in xtend

I am learning xtend. What would be a nice way to create a comma separated list in xtend? (something like the SEPARATOR in xpand) I want to produce a comma separated list of parameters in my generator: «FOR param: row.params» …
moin moin
  • 2,263
  • 5
  • 32
  • 51
5
votes
1 answer

Xtend loop break

In Xtend, is it possible to break in a loop or have a check to discontinue the loop? «FOR e:d.entitys» «FOR a:e.attributes» «IF a.eClass.name.contentEquals('Something')» «e.name» "This output should be output one for each…
Charles Henry
  • 353
  • 3
  • 16
4
votes
1 answer

Using Xtend for Android development (again)

I am having 2 main sticking point to get the following simple WebView example to compile: The casting part (WebView)findViewById(R$id::webview) gives unresolved JvmIdentifiableElement The anonymous class part totally doesn't work. I suppose Xtend…
kizzx2
  • 18,775
  • 14
  • 76
  • 83
4
votes
3 answers

How to break foreach loop in xtend?

I have below code : Which is iterating the arrayList till end even though I don't want it. I don't know how to break it as xtend does not have break statement. Provided I can't convert the same to a while loop, is there any alternative way in xtend…
lifeline2
  • 69
  • 1
  • 15
4
votes
2 answers

Xtext custom validator warning - How to mark keyword?

I have the simple Greeting example in xtext. So the DSL is defined like this: grammar org.xtext.example.mydsl.Tests with org.eclipse.xtext.common.Terminals generate tests "http://www.xtext.org/example/mydsl/Tests" Model: greetings+=…
Fabian
  • 547
  • 1
  • 4
  • 17
4
votes
2 answers

Type field of Property not filled in for UML PrimitiveType in Xpand

I have an XPT template that generates text from a UML model. This is the excerpt I use on the attributes of a class «FOREACH attribute AS a» Id: «a.name» Type: «a.type.name» «ENDFOREACH» All works well as long as the type is a class from…
allprog
  • 16,540
  • 9
  • 56
  • 97
4
votes
1 answer

How to call Java code from Xpand?

I want to call an arbitrary Java method from an Xpand template (e.g. a static method). How can I do this?
thSoft
  • 21,755
  • 5
  • 88
  • 103
4
votes
2 answers

Use Xtext or XTend to build code generator for existing EMF Model

I have a transformation sequence of models that eventually outputs an EMF model, instance of some EMF Meta model (the meta model I defined myself). I am looking for a good way to generate code from this. Of course, there is XPand, I used to use…
Marten Sytema
  • 1,906
  • 3
  • 21
  • 29
4
votes
1 answer

Combining two Iterables using standard library -- or -- map with multiple Iterables

When given two Iterables val keys = newLinkedList('foo', 'bar', 'bla') val vals = newLinkedList(42, 43, 44) I want to correlate each item in both lists like this: val Iterable> expected = newLinkedList('foo'->42,…
A.H.
  • 63,967
  • 15
  • 92
  • 126
3
votes
1 answer

How to generate AST using Xtext and Xtend?

So I have the default example of a xtext grammar. grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: greetings+=Greeting*; Greeting: 'Hello'…
Joe
  • 4,367
  • 7
  • 33
  • 52
3
votes
1 answer

Maven builds multi module project succesfully, Eclipse shows errors

Note: this question is similar to this one, but the answers there did not work for me. I have an odd problem: using Maven in the command line, my build is succesful, but imported in Eclipse it still shows errors. In particular, I'm trying to build…
Safron
  • 802
  • 1
  • 11
  • 23
3
votes
0 answers

Xtend with Maven does not preserved semantic

I try to work a bit with Xtend and Xcore for a student project. For that, I configured a Maven project with dependencies to generate xtend/xcore sources by the Maven generate-sources phase. Xtend classes and Xcore models are well compiled to Java,…
Oromis
  • 196
  • 2
  • 13
3
votes
1 answer

What is a different term for "non-static"?

I would like to add a comment saying: // Here comes the block of non-static members. But I would like to avoid negations. So I would like to use another term for "non-static". To be clear: I mean "static" like in Integer.valueOf("42") I mean…
armin.miedl
  • 1,070
  • 1
  • 11
  • 16
3
votes
1 answer

Is it possible to embed Java compiler into an application?

With Xtext and Xtend, I have written a DSL grammar as well as its associated code generator which creates a bunch of Java source files making up a Java application. I would like to provide my colleagues with a program which lets them select a file…
Georgie
  • 77
  • 6
1
2
3
27 28