You need to create a mapping for the Java method in the template. This excellent article explains in detail the process http://pettergraff.blogspot.de/2009/11/how-to-write-extension-in-xtend-for.html
Example:
CalledJavaCode.java
package template; public class CalledJavaCode { public static String evaluate(Object o) { return "some evaluation"; } }
Template.xpt
//Xtend mapping for Java in template file String eval(Object this) : JAVA template.CalledJavaCode.evaluate(java.lang.Object); // Template.xpt usage of mapping «FOREACH attribute AS a» «eval(a)» «ENDFOREACH»
source share