public class RandomDirective extends Directive { private java.util.Random random = new java.util.Random(); public void exec(Env env, Scope scope, Writer writer) { try { writer.write(random.nextInt()); } catch (IOException e) { throw new TemplateException(e.getMessage(), location, e); } } } public class UUIDDirective extends Directive { @Override public void exec(Env env, Scope scope, Writer writer) { try { UUID uuid = UUID.randomUUID(); writer.write(uuid.toString()); } catch (IOException e) { throw new TemplateException(e.getMessage(), location, e); } } }