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
2 answers

the example for annotation from xtend 2.4.0 document doesn't work

the below code is from xtend's official site. @TypeAnnotation("some value") class MyClass { @FieldAnnotation(children = #[ @MyAnno(true), @MyAnno(false) ]) String myField5. @MethodAnnotation(children = #[ @MyAnno(true), @MyAnno ]) …
redtank
  • 61
  • 5
1
vote
1 answer

Xtend "Movies example" best answer

I followed the Xtend tutorial and the Movies example. At the end of this tutorial, you can find this question: @Test def void sumOfVotesOfTop2() { val long sum = movies.sortBy[ -rating ].take(2).map[ numberOfVotes ].reduce[ a, b | a + b ] …
Antwane
  • 20,760
  • 7
  • 51
  • 84
1
vote
2 answers

Additional Constructor for Xtend @Data Value Object

How can I add a secondary constructor to a Value Object (annotaded with @Data) in XTend (XText)? I have tried the following, but it doesnt compile: @Data class Dependency { val String groupId; val String artifactId; val String version; …
Nils Schmidt
  • 3,702
  • 6
  • 23
  • 28
1
vote
1 answer

xtend code generation file output (ordering files into packages)

Here is an example of some of my xtend code: for(e: resource.allContents.toIterable.filter(typeof(Entity))) { fsa.generateFile(e.name.toFirstUpper + ".java", e.compileEntity) } def…
Charles Henry
  • 353
  • 3
  • 16
1
vote
1 answer

Xtext Xbase JvmTypesBuilder only final parameter generated

I'm tring to generate, using the Xtend Xbase API, a simple Java mathod. This is the Xtend code. var jvmMethod = element.toMethod("fromSap",element.newTypeRef(element.dtoFullName))[ var jvmTypeReference= fromSap.sapType; var param =…
Panciz
  • 2,183
  • 2
  • 30
  • 54
1
vote
1 answer

Saving self-written code - xtend

I want to know if it is possible to save self-written code within a generated file. If you change the model and then push the save button, all code is overwritten. I want to save some of the code of the old file.
user1104033
1
vote
1 answer

Xtend/Xtext Datatypes

I have a problem with my in Xtext created Datatypes. The problems lies within this function: «FOR e: bla.EAllAttributes» «e.EType.name» «e.name»; «ENDFOR» This for-loop just returns EInt or EString for e.EType.name. But i need the…
user1104033
1
vote
1 answer

XTEND - Resource Management

i have a very specific Question about Xtend. In every example i read about xText/xTend i see something like this: override void doGenerate(Resource resource, IFileSystemAccess fsa) { for(e: resource.allContents.toIterable.filter(typeof(Entity))) { …
user1104033
1
vote
1 answer

Xtext - Generating object - generate more data

I have xtext file similar to the xtext describe in here: (www.ebpml.org/blog2/index.php/2010/11/05/mde-xtext-and-json) JSONDataSource: root = Object ; Object: '{' firstObject=TerminalObject (',' objects+=TerminalObject)* '}'; Array:…
Dana Klein
  • 159
  • 1
  • 12
1
vote
1 answer

XText register global variables

I want to build tool support for the jape language from gate with the help of XText. Jape is basically a pattern language over annotations; you declare the actions to take when you encounter those annotations. The problem is that the actions can be…
nikolavp
  • 173
  • 5
1
vote
1 answer

xtext generator forward input to output

How to forward the part of the parsed tree from input to output in xtend generator? For instance, in some cases of output code generation, I do not need to parse the parameters of some constructor/functions. I only need to put this constants,…
Lev
  • 921
  • 7
  • 15
1
vote
2 answers

How to assign a char in Xtend?

How can a variable of type char be assigned? I am looking for the Xtend equivalent of javas: char c='?'; In Xtend the compiler reject all quotation marks like ' or " because they produce a String: var char c='?'; ^ Error: Incompatible types.…
Chriss
  • 5,157
  • 7
  • 41
  • 75
1
vote
1 answer

Run Xtext product directly

I am using on Xtext to create my own language. My product uses Xtend to generate from my language to Java and I can right click on the generated Java file to run it. But I would like to right click on my own language file and run it directly, then…
MielTP
  • 13
  • 3
1
vote
2 answers

JVM languages for J2ME platform

I'm currently writing an embedded application for J2ME environment (CLDC 1.1 configuration and IMP-NG profile). Being spoiled by all those new features in JVM-based languages (Groovy, Scala, Clojure, you name it), I was considering using one of them…
pwes
  • 2,040
  • 21
  • 30
0
votes
1 answer

Look for a auto indentation plugin for Eclipse

Today I'm trying the xtend to write a simple program. Looks good, but it doesn't support code formatting! So I'm looking for an Eclipse plugin that can auto indent the code. No matter xtend or other language that eclipse doesn't support, it can auto…
Freewind
  • 193,756
  • 157
  • 432
  • 708