Skip to content

Instantly share code, notes, and snippets.

@mikebrock
Created April 25, 2014 21:16
Show Gist options
  • Save mikebrock/11303564 to your computer and use it in GitHub Desktop.
Save mikebrock/11303564 to your computer and use it in GitHub Desktop.
public static class Barz {
public List<Fooz> foos = new ArrayList<>();
public Barz() {
foos.add(new Fooz());
foos.add(new Fooz());
}
}
public static class Fooz {
public String invokeMethod() {
return "foo";
}
}
public void testIteration() {
CompiledTemplate compiledTemplate =
TemplateCompiler.compileTemplate("@foreach{foo:foos}@{foo.invokeMethod()}@end{}");
System.out.println(TemplateRuntime.execute(compiledTemplate, new Barz()));
}
}
---
Output: foofoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment