import java.util.function.*;

class JDBC {
  void transaction(Consumer<ConnectionW> f) {
    f.accept(new ConnectionW());
  }
  <T> T transaction(Function<ConnectionW, T> f) {
    return f.apply(new ConnectionW());
  }
}

class ConnectionW {
  SQL prepare() {
    return new SQL();
  }
}

class SQL implements StringTemplate.Processor<PreparedStatementW, RuntimeException> {
  public PreparedStatementW process(StringTemplate template) throws RuntimeException {
    System.out.println(template.fragments());
    return new PreparedStatementW();
  }
}

class PreparedStatementW {
  void execute() {
    System.out.println("Here I am!");
  }
}

void main() {
  var jdbc = new JDBC();
  jdbc.transaction(conn -> {
    var name = "a";
    var age = 100;
    conn.prepare()."""
      insert into "test_user" ("name", "age") values (\{name}, \{age})"""
      .execute();
  });
}