protected void generateClientGetterAndSetter(JavaWriter out) { out.println(); out.tab(1).println("private AsyncJooqSQLClient client;"); out.println(); generateSetVertxAnnotation(out); out.tab(1).println("@Override"); out.tab(1).println("public void setClient(AsyncJooqSQLClient client) {"); out.tab(2).println("this.client = client;"); out.tab(1).println("}"); out.println(); out.tab(1).println("@Override"); out.tab(1).println("public AsyncJooqSQLClient client() {"); out.tab(2).println("return this.client;"); out.tab(1).println("}"); out.println(); }
@Override protected void generateVertxGetterAndSetterConfigurationMethod(JavaWriter out) { out.println(); out.tab(1).println("private io.vertx.rxjava.core.Vertx vertx;"); out.println(); generateSetVertxAnnotation(out); out.tab(1).println("@Override"); out.tab(1).println("public void setVertx(io.vertx.core.Vertx vertx) {"); out.tab(2).println("this.vertx = new io.vertx.rxjava.core.Vertx(vertx);"); out.tab(1).println("}"); out.println(); out.tab(1).println("@Override"); out.tab(1).println("public void setVertx(io.vertx.rxjava.core.Vertx vertx) {"); out.tab(2).println("this.vertx = vertx;"); out.tab(1).println("}"); out.println(); out.tab(1).println("@Override"); out.tab(1).println("public io.vertx.rxjava.core.Vertx vertx() {"); out.tab(2).println("return this.vertx;"); out.tab(1).println("}"); out.println(); }
@Override protected void generateVertxGetterAndSetterConfigurationMethod(JavaWriter out) { out.println(); out.tab(1).println("private io.vertx.reactivex.core.Vertx vertx;"); out.println(); generateSetVertxAnnotation(out); out.tab(1).println("@Override"); out.tab(1).println("public void setVertx(io.vertx.reactivex.core.Vertx vertx) {"); out.tab(2).println("this.vertx = vertx;"); out.tab(1).println("}"); out.println(); out.tab(1).println("@Override"); out.tab(1).println("public io.vertx.reactivex.core.Vertx vertx() {"); out.tab(2).println("return this.vertx;"); out.tab(1).println("}"); out.println(); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public CompletableFuture<%s> fetchOneBy%sAsync(%s value) {", pType,colClass, colType); out.tab(2).println("return fetchOneAsync(%s,value);", colIdentifier); out.tab(1).println("}"); }
@Override protected void generateFetchByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch records that have <code>%s IN (values)</code> asynchronously", colName); out.tab(1).println("public CompletableFuture<List<%s>> fetchBy%sAsync(%s<%s> values) {", pType, colClass, List.class, colType); //out.tab(2).println("return fetch(%s, values);", colIdentifier); out.tab(2).println("return fetchAsync(%s,values);", colIdentifier); out.tab(1).println("}"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public CompletableFuture<%s> fetchOneBy%sAsync(%s value) {", pType,colClass, colType); out.tab(2).println("return FutureTool.executeBlocking(h->h.complete(fetchOneBy%s(value)),vertx());", colClass); out.tab(1).println("}"); }
@Override protected void generateDAOImports(JavaWriter out) { out.println("import io.reactivex.Completable;"); out.println("import io.reactivex.Observable;"); out.println("import io.reactivex.Single;"); out.println("import io.github.jklingsporn.vertx.jooq.async.rx.util.RXTool;"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public Single<%s> fetchOneBy%sAsync(%s value) {", pType,colClass, colType); out.tab(2).println("return RXTool.executeBlocking(h->h.complete(fetchOneBy%s(value)),vertx());", colClass); out.tab(1).println("}"); }
@Override protected void generateFetchByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch records that have <code>%s IN (values)</code> asynchronously", colName); out.tab(1).println("public Single<List<%s>> fetchBy%sAsync(%s<%s> values) {", pType, colClass, List.class, colType); out.tab(2).println("return fetchAsync(%s,values);", colIdentifier); out.tab(1).println("}"); out.tab(1).javadoc("Fetch records that have <code>%s IN (values)</code> asynchronously", colName); out.tab(1).println("public Observable<%s> fetchBy%sObservable(%s<%s> values) {", pType, colClass, List.class, colType); out.tab(2).println("return fetchObservable(%s,values);", colIdentifier); out.tab(1).println("}"); }
@Override protected void generateDAOImports(JavaWriter out) { out.println("import io.reactivex.Completable;"); out.println("import io.reactivex.Observable;"); out.println("import io.reactivex.Single;"); out.println("import io.github.jklingsporn.vertx.jooq.async.rx.util.RXTool;"); out.println("import io.github.jklingsporn.vertx.jooq.async.rx.AsyncJooqSQLClient;"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public Single<%s> fetchOneBy%sAsync(%s value) {", pType,colClass, colType); out.tab(2).println("return fetchOneAsync(%s,value);", colIdentifier); out.tab(1).println("}"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public void fetchOneBy%sAsync(%s value,Handler<AsyncResult<%s>> resultHandler) {", colClass, colType,pType); out.tab(2).println("fetchOneAsync(%s,value,resultHandler);", colIdentifier); out.tab(1).println("}"); }
@Override protected void generateFetchByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch records that have <code>%s IN (values)</code> asynchronously", colName); out.tab(1).println("public void fetchBy%sAsync(%s<%s> values,Handler<AsyncResult<List<%s>>> resultHandler) {", colClass, List.class, colType,pType); //out.tab(2).println("return fetch(%s, values);", colIdentifier); out.tab(2).println("fetchAsync(%s,values,resultHandler);", colIdentifier); out.tab(1).println("}"); }
@Override protected void renderInsertReturningOverwrite(TableDefinition table, JavaWriter out, String reason) { out.println(); out.tab(1).println("@Override"); out.tab(1).println("public void insertReturningPrimaryAsync(%s object, Handler<AsyncResult<%s>> resultHandler){", out.ref(getStrategy().getFullJavaClassName(table, GeneratorStrategy.Mode.POJO)), getKeyType(table.getPrimaryKey())); out.tab(2).println("throw new UnsupportedOperationException(\"%s\");",reason); out.tab(1).println("}"); out.println(); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType, String colIdentifier) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public void fetchOneBy%sAsync(%s value,Handler<AsyncResult<%s>> resultHandler) {", colClass, colType,pType); out.tab(2).println("vertx().executeBlocking(h->h.complete(fetchOneBy%s(value)),resultHandler);", colClass); out.tab(1).println("}"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public CompletableFuture<%s> fetchOneBy%sAsync(%s value) {", pType,colClass, colType); out.tab(2).println("return FutureTool.executeBlocking(h->h.complete(fetchOneBy%s(value)),vertx());", colClass); out.tab(1).println("}"); }
@Override protected void generateDAOImports(JavaWriter out) { out.println("import io.reactivex.Completable;"); out.println("import io.reactivex.Observable;"); out.println("import io.reactivex.Single;"); out.println("import io.github.jklingsporn.vertx.jooq.rx.util.RXTool;"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public Single<%s> fetchOneBy%sAsync(%s value) {", pType,colClass, colType); out.tab(2).println("return RXTool.executeBlocking(h->h.complete(fetchOneBy%s(value)),vertx());", colClass); out.tab(1).println("}"); }
@Override protected void generateFetchOneByMethods(JavaWriter out, String pType, String colName, String colClass, String colType) { out.tab(1).javadoc("Fetch a unique record that has <code>%s = value</code> asynchronously", colName); out.tab(1).println("public void fetchOneBy%sAsync(%s value,Handler<AsyncResult<%s>> resultHandler) {", colClass, colType,pType); out.tab(2).println("vertx().executeBlocking(h->h.complete(fetchOneBy%s(value)),resultHandler);", colClass); out.tab(1).println("}"); }
@Override protected void generateDAOImports(JavaWriter out) { out.println("import java.util.concurrent.CompletableFuture;"); out.println("import io.github.jklingsporn.vertx.jooq.async.future.AsyncJooqSQLClient;"); }
@Override protected void generateVertxGetterAndSetterConfigurationMethod(JavaWriter out) { //noop }
@Override protected void generateDaoClassFooter(TableDefinition table, JavaWriter out) { super.generateDaoClassFooter(table, out); generateClientGetterAndSetter(out); generateJsonMapper(table,out); }
@Override protected void generateDAOImports(JavaWriter out) { out.println("import java.util.concurrent.CompletableFuture;"); out.println("import io.github.jklingsporn.vertx.jooq.future.async.impl.FutureTool;"); }