java - Xtend/Xpand find and replace (rule) -



java - Xtend/Xpand find and replace (rule) -

is possible set rule allow xpand method output specified string of text depending on input. example:

«for a:e.attributes» type = «a.eclass.name» value = «a.name.tofirstupper» «endfor»

the above code may output:

type = stringattribute value = string1 type = integerattribute value = 123

how create output:

type = string value = string1 type = int value = 123

i know can done if statements able more or less automatic. waste have specify such rules every time need output these details in same file. show me kind of code utilize accomplish this? give thanks you.

i suggest create reusable xtend helper

tosimplename(string inp): switch (inp) { case "stringattribute" : "string" case "integerattribute" : "int" // ...more cases here... default : inp } ;

and phone call xpand template this:

«for a:e.attributes» type = «a.eclass.name.tosimplename()» value = «a.name.tofirstupper» «endfor»

java loops xtext xtend xpand

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -