Last active
January 20, 2025 05:26
-
-
Save ZenLiuCN/9b4605b3c13417d6b4363b919f394bf9 to your computer and use it in GitHub Desktop.
VertX templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="VertX"> | |
<template name="ieEntity" value="record $name$( Context ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$X.DataJson data ) implements Entities<$ELE$, $ELE$X.DataJson, $name$> { static $name$ of( Context ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$X.DataJson data){ return new $name$(ctx,tx,data); } static $name$ of( Context ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$ data){ return new $name$(ctx,tx,$ELE$X.fromAsJson(data)); } @Override public $name$ $it() { return this; } @Override public java.util.function.Function<$ELE$, $ELE$X.DataJson> $toJson() { return $ELE$X::fromAsJson; } @Override public java.util.function.Function<$ELE$X.DataJson, $name$> $ctor() { return d -> new $name$(ctx, tx, d); } }" description="Entity template" toReformat="true" toShortenFQNames="true"> | |
<variable name="ELE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="name" expression="camelCase(ELE)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieEntities" value="interface Entities< E extends com.medtreehealth.vertx.api.Entity, J extends com.medtreehealth.vertx.api.util.CopyableX<? extends E> & com.medtreehealth.vertx.api.util.XJsonData, XE extends Entities<E, J, XE> > extends com.medtreehealth.vertx.api.util.XUnits.XEntityTransaction<E, J, XE, $CTX$> { 	 }" description="units Entities" toReformat="true" toShortenFQNames="true"> | |
<variable name="CTX" expression="completeSmart()" defaultValue="Context" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieCtx" value="class Context extends $DOMAIN$UX<io.vertx.sqlclient.Pool, Context> implements com.medtreehealth.vertx.api.util.XUnits.XTransactional<Context>{ final org.slf4j.Logger log; Context(com.medtreehealth.vertx.api.util.xquery.XDialect dialect, io.vertx.sqlclient.Pool sql, io.vertx.core.Vertx vertx, $END$ io.vertx.core.json.JsonObject config, org.slf4j.Logger log) { super(dialect, sql, vertx /*Todo*/); this.log = log; } @Override public Context itself() { return this; } }" description="units context" toReformat="true" toShortenFQNames="true"> | |
<variable name="DOMAIN" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defSys" value="@com.medtreehealth.vertx.api.util.annotation.VertX(withProxy = true) @com.medtreehealth.vertx.api.util.annotation.UnitsX( stores = {}, abilityProviders = {}, auditor = "$END$::$MODULE$", notifiers = {}, listeners = {} ) public interface $NAME$ extends com.medtreehealth.vertx.api.Sys { org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger($NAME$.class); @Override default Class<? extends $NAME$> type() { return $NAME$ .class; } @Override default List<Class<? extends Sys>> dependencies() { return java.util.List.of(com.medtreehealth.services.foundation.api.user.Users.class, com.medtreehealth.services.foundation.api.audit.Auditor.class); } } " description="system template" toReformat="true" toShortenFQNames="true"> | |
<variable name="MODULE" expression="camelCase(NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defErrors" value="@com.medtreehealth.vertx.api.util.ErrorX.Errors public interface Errors { ErrorX.Define STATUS_CONFLICT = ErrorX.Define.CODE_CONFLICT("状态冲突,请检查重试"); }" description="errors template" toReformat="true" toShortenFQNames="true"> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defRecord" value="@com.medtreehealth.vertx.api.util.annotation.VertX(table = "$PRE$_rec_$tab$") public interface $NAME$ extends com.medtreehealth.vertx.api.Rec, com.medtreehealth.vertx.api.Entity,$END${ @Override default Class<? extends $NAME$> type() { return $NAME$.class; } }" description="Record element template" toReformat="true" toShortenFQNames="true"> | |
<variable name="PRE" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="tab" expression="snakeCase(NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defEvent" value="@com.medtreehealth.vertx.api.util.annotation.VertX(withRow = false, withOutCodec = true, eventAddress = "$ADDRESS$") public interface $NAME$ extends com.medtreehealth.vertx.api.Event { @Override default Class<? extends $NAME$> type() { return $NAME$.class; } int KIND_EVENT_SAMPLE = 0; }" description="event template" toReformat="true" toShortenFQNames="true"> | |
<variable name="ADDRESS" expression="" defaultValue="domain::event-address" alwaysStopAt="true" /> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defAble" value="@com.medtreehealth.vertx.api.util.annotation.VertX(table = "$PRE$_able_$TABLE$", provider = true, providerAssignPayload = $REGISTER_VALUE$.class) public interface $NAME$ extends com.medtreehealth.vertx.api.Ability, com.medtreehealth.vertx.api.Entity,$END$ { @Override default Class<? extends $NAME$> type() { return $NAME$.class; } @Override long user(); }" description="Ablitity template" toReformat="true" toShortenFQNames="true"> | |
<variable name="PRE" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="TABLE" expression="snakeCase(NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="REGISTER_VALUE" expression="concat("Register.",NAME,"Register")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defValue" value=" @com.medtreehealth.vertx.api.util.annotation.VertX(withRow = false, validate = true) public interface $NAME$ extends com.medtreehealth.vertx.api.Element, com.medtreehealth.vertx.api.util.ValidX.Validatable< $NAME$> { @Override default Class<? extends $NAME$> type() { return $NAME$.class; } @ValidX.Validate(code = 1, rule = "::phoneCN", message = "手机号错误") String sample1(); @ValidX.Validate(code = 2, rule = "::notBlank", message = "名字无效") String sample2(); } " description="Value with validation" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieVerticle" value="@lombok.extern.slf4j.Slf4j @lombok.experimental.Accessors(fluent = true) @com.google.auto.service.AutoService(com.medtreehealth.vertx.core.verticle.VerticleX.class) public class $NAME$ extends com.medtreehealth.vertx.core.verticle.VerticleX.SingularMySQLProxiesBinder<$DOMAIN$> implements VerticleX.ReDeployable { public $NAME$() {//for SPI super("",JsonObject.of()); } public $NAME$(@lombok.NonNull io.vertx.core.json.JsonObject config) { super("$config$", config); log.info("launching {}", this.getClass()); } @Override protected $DOMAIN$ system() { return new $DOMAIN$Impl( vertx, sql(), dialect(), conf().value() $END$ ); } }" description="Verticle template" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="DOMAIN" expression="groovyScript("_1.minus('Verticle')",NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="config" expression="camelCase(DOMAIN)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLTable" value="CREATE TABLE IF NOT EXISTS $TABLE$_$KIND$_$MODULE$ ( id bigint auto_increment not null primary key comment '系统ID', 	$END$ version integer not null default 0 comment '系统数据版本', removed boolean not null default false comment '系统删除', create_by bigint not null default -1 comment '系统创建操作用户', create_at timestamp not null default CURRENT_TIMESTAMP comment '系统创建时间', modified_at timestamp not null default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '系统更新时间', modified_by bigint not null default -1 comment '系统创建操作用户', index idx_$TABLE$_$KIND$_$MODULE$_sys_version (removed, version) ) comment '$PROJECT$:$DOMAIN$:$NAME$';" description="MySQL DDL table" toReformat="true" toShortenFQNames="true"> | |
<variable name="TABLE" expression="groovyScript("_1.minus('.ddl.mysql')",fileNameWithoutExtension())" defaultValue="" alwaysStopAt="false" /> | |
<variable name="KIND" expression="enum("able","actor","rec")" defaultValue="" alwaysStopAt="true" /> | |
<variable name="MODULE" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="PROJECT" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="DOMAIN" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ieUT" value="import cn.zenliu.units.error.DomainError; import com.medtreehealth.services.foundation.api.audit.Auditor; import com.medtreehealth.services.foundation.api.user.Users; import com.medtreehealth.services.foundation.api.user.actor.User; import com.medtreehealth.services.foundation.api.user.actor.UserX; import com.medtreehealth.vertx.api.util.AssertX; import com.medtreehealth.vertx.api.util.ErrorX; import com.medtreehealth.vertx.api.util.XJsonData; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.json.Json; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.junit5.VertxExtension; import io.vertx.junit5.VertxTestContext; import io.vertx.sqlclient.Pool; import lombok.extern.slf4j.Slf4j; import org.jooq.lambda.Seq; import org.junit.jupiter.api.*; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; import static com.medtreehealth.vertx.api.util.FuncX.accept; import static com.medtreehealth.vertx.api.util.FuncX.required; import static com.medtreehealth.vertx.api.util.TupleX.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.when; @ExtendWith({VertxExtension.class, MockitoExtension.class}) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) @Slf4j class $NAME$ { interface Data { UserX.DataJson user = new UserX.DataJson().id(1L).version(0); JsonArray userX = JsonArray.of("removed","version", "id"); } @Test @Order(1) void sample(Vertx vertx, VertxTestContext vtc) { var sys = factory(vertx); vtc.assertComplete(Future.succeededFuture()) .flatMap(AssertX.expectEquals($ -> Future.succeededFuture(Data.user), () -> Data.user, Data.userX)) .onComplete(r -> { if (r.failed()) vtc.failNow(r.cause()); vtc.completeNow(); }); } //region Tools Pool sql; Auditor auditor; @Mock Users users; AutoCloseable mockCloser; @BeforeAll void setup(Vertx vertx, VertxTestContext vtc) { System.out.println("before all"); mockCloser = MockitoAnnotations.openMocks(this); // mockito //data-source sql = io.vertx.mysqlclient.MySQLBuilder.pool().using(vertx) .connectingTo("mysql://root:[email protected]:3306/sample?serverTimezone=UTC") .build(); auditor = Auditor.EVENT_LOGGING_AUDITOR.apply(vertx); sql.query(Stream.of( //TABLE names of storage SampleX.XStore.ITable.TABLE_NAME ,Sample2X.XStore.ITable.TABLE_NAME ).map(t -> "TRUNCATE TABLE " + t).collect(Collectors.joining(";"))) .execute() .transform(AssertX.executeDDL(vertx, sql, "$END$.ddl.mysql.sql", false)) .onComplete(vtc.succeedingThenComplete()); } @AfterAll void teardown(VertxTestContext vtc) throws Exception { mockCloser.close(); if (sql != null) sql.close().onComplete(vtc.succeedingThenComplete()); } volatile $DOMAIN$ sys; final Object lock=new Object(); $DOMAIN$ factory(Vertx vertx) { if(sys==null){ synchronized (lock){ if(sys==null) sys= new $DOMAIN$Impl(vertx, sql, com.medtreehealth.vertx.api.util.xquery.XDialect.mysql(java.time.ZoneOffset.ofHours(8)), ((JsonObject) Json.decodeValue("{}")) ); } } return sys; } //endregion } " description="unit test for domain (file should named as DomainImplTest)" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="DOMAIN" expression="groovyScript("_1.minus('ImplTest')",NAME)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="apiAct" value="io.vertx.core.Future<$TYPE$> $NAME$Register(User user, $REGISTER$ register, $ABLITY$ actor); io.vertx.core.Future<Optional<$TYPE$>> $NAME$Of(com.medtreehealth.services.foundation.api.user.actor.User user); io.vertx.core.Future<Optional<$TYPE$>> $NAME$OfId(long id); io.vertx.core.Future<Void> $NAME$Drop($TYPE$ $NAME$,@org.jetbrains.annotations.Nullable $DROP_INFO$ payload,$ABLITY$ actor); io.vertx.core.Future<$TYPE$> $NAME$Update($END$,com.medtreehealth.vertx.api.Entry $NAME$, $ABLITY$ actor); " description="common api for actor or ablitiy" toReformat="true" toShortenFQNames="true" useStaticImport="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="true" /> | |
<variable name="REGISTER" expression="completeSmart()" defaultValue="JsonObject" alwaysStopAt="true" /> | |
<variable name="DROP_INFO" expression="completeSmart()" defaultValue="JsonObject" alwaysStopAt="true" /> | |
<variable name="ABLITY" expression="completeSmart()" defaultValue=" com.medtreehealth.services.foundation.api.user.actor.User" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="apiRec" value="io.vertx.core.Future<$TYPE$> $NAME$Register($REGISTER$ register, $ABLITY$ actor); io.vertx.core.Future<Optional<$TYPE$>> $NAME$OfId(long id); io.vertx.core.Future<Void> $NAME$Drop(com.medtreehealth.vertx.api.Entry $NAME$, $DROP_INFO$ payload, $ABLITY$ actor); io.vertx.core.Future<$TYPE$> $NAME$Update($END$,com.medtreehealth.vertx.api.Entry $NAME$, $ABLITY$ actor);" description="common api for record" toReformat="true" toShortenFQNames="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="true" /> | |
<variable name="REGISTER" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="ABLITY" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="DROP_INFO" expression="completeSmart()" defaultValue="JsonObject" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="apiPublish" value="io.vertx.core.Future<$TYPE$> $NAME$Register($REGISTER$ register, $ABLITY$ actor); io.vertx.core.Future<Optional<$TYPE$>> $NAME$OfId(long id); io.vertx.core.Future<$TYPE$> $NAME$Revoke(com.medtreehealth.vertx.api.Entry $NAME$ , $ABLITY$ actor); io.vertx.core.Future<$TYPE$> $NAME$Update($END$,com.medtreehealth.vertx.api.Entry $NAME$ , $ABLITY$ actor); io.vertx.core.Future<$TYPE$> $NAME$Publish(com.medtreehealth.vertx.api.Entry $NAME$ , $ABLITY$ actor); io.vertx.core.Future<$TYPE$> $NAME$CancelPublish(com.medtreehealth.vertx.api.Entry $NAME$ , $ABLITY$ actor); io.vertx.core.Future<Void> $NAME$Drop(com.medtreehealth.vertx.api.Entry $NAME$ , $ABLITY$ actor);" description="Publishable trait common api for record or actor or ablity" toReformat="true" toShortenFQNames="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="REGISTER" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="ABLITY" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="pomVerticle" value=" <properties> <module.name>mth.services.vertx.$END$.verticle</module.name> </properties> <artifactId>$PREFIX$-verticle</artifactId> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>$PREFIX$-api</artifactId> </dependency> <dependency> <groupId>com.medtreehealth.vertx</groupId> <artifactId>core</artifactId> </dependency> <dependency> <groupId>io.vertx</groupId> <artifactId>vertx-mysql-client</artifactId> </dependency> </dependencies>" shortcut="ENTER" description="verticle pom" toReformat="true" toShortenFQNames="true"> | |
<variable name="PREFIX" expression="complete()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="MAVEN" value="true" /> | |
</context> | |
</template> | |
<template name="pomApi" value=" <properties> <module.name>mth.services.vertx.$END$.api</module.name> </properties> <artifactId>$PREFIX$-api</artifactId> <dependencies> <dependency> <groupId>com.medtreehealth.services</groupId> <artifactId>foundation-api</artifactId> </dependency> </dependencies>" shortcut="ENTER" description="pom segment for api" toReformat="true" toShortenFQNames="true"> | |
<variable name="PREFIX" expression="complete()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="MAVEN" value="true" /> | |
</context> | |
</template> | |
<template name="pomBom" value=" <dependency> <groupId>${project.groupId}</groupId> <artifactId>$PREFIX$-api</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>$PREFIX$-verticle</artifactId> <version>${project.version}</version> </dependency>" shortcut="ENTER" description="pom bom segement for one module" toReformat="true" toShortenFQNames="true"> | |
<variable name="PREFIX" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="MAVEN" value="true" /> | |
</context> | |
</template> | |
<template name="imStore" value="default $TYPE$X.XStore $NAME$() { return store($TYPE$X::store); } default $TYPE$X.XStore $NAME$(io.vertx.sqlclient.SqlConnection tx) { return tx==null?$NAME$():store((d, x) -> $TYPE$X.store(d, tx)); }" description="entity store segment" toReformat="true" toShortenFQNames="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieSys" value="public class $NAME$ extends com.medtreehealth.vertx.core.verticle.ServiceX.WareHouseX implements $TYPE$ { final $CTX$ ctx; @Override public io.vertx.core.Future<Void> dispose() { return ctx.dispose(); } $NAME$(io.vertx.core.Vertx vertx, io.vertx.sqlclient.Pool sql, com.medtreehealth.vertx.api.util.xquery.XDialect dialect, io.vertx.core.json.JsonObject config) { super(vertx, sql, dialect); ctx = new $CTX$(dialect, sql, vertx ,$END$ config, log); } }" description="sys implement" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="TYPE" expression="groovyScript("_1.minus('Impl')",NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="CTX" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieCtxErr" value="class Context extends $API$.$DOMAIN$<Pool, Context> implements com.medtreehealth.vertx.api.util.XUnits.XTransactional<Context> { final org.slf4j.Logger log; final $API$.util.ErrorsX errors; Context(com.medtreehealth.vertx.api.util.xquery.XDialect dialect, io.vertx.sqlclient.Pool sql, io.vertx.core.Vertx vertx, $END$ io.vertx.core.json.JsonObject config, org.slf4j.Logger log){ super(dialect, sql, vertx /*Todo*/); this.log = log; this.errors = ErrorsX.of(config, log); } @Override public Context itself() { return this; } }" description="units context with errors" toReformat="true" toShortenFQNames="true"> | |
<variable name="DOMAIN" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="API" expression="groovyScript("return _1.substring(0,_1.lastIndexOf(File.separator)).replace('verticle','api').replace(File.separator,'.')",fileRelativePath())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imEntFac" value="static io.vertx.core.Future<$ENT$> $ENT$($CTX$ cx, @Nullable io.vertx.sqlclient.SqlConnection tx, com.medtreehealth.vertx.api.Entry entry) { return cx.$ENT$(tx) .maybe(entry) .map(com.medtreehealth.vertx.api.util.FuncX.required(cx.errors::$CODE$)) .map(p->new $ENT$(cx,tx,$API$.util.$ENTITY$.fromAsJson(p))) ; } static io.vertx.core.Future<$ENT$> $ENT$($CTX$ cx, @Nullable io.vertx.sqlclient.SqlConnection tx, long id) { return cx.$ENT$(tx) .maybe(id) .map(com.medtreehealth.vertx.api.util.FuncX.required(cx.errors::$CODE$)) .map(p->new $ENT$(cx,tx,$API$.util.$ENTITY$.fromAsJson(p))) ; }" description="impl of entity factory segment" toReformat="true" toShortenFQNames="true"> | |
<variable name="ENT" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="CTX" expression="completeSmart()" defaultValue="Context" alwaysStopAt="false" /> | |
<variable name="CODE" expression="" defaultValue="notFound" alwaysStopAt="true" /> | |
<variable name="ENTITY" expression="concat(capitalize(ENT),"X")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="API" expression="groovyScript("_1.substring(0,_1.lastIndexOf(File.separator)).replace('verticle','api').replace(File.separator,'.')",fileRelativePath())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imAsyncCacheID" value="$cache$=com.github.benmanes.caffeine.cache.Caffeine.from($SPEC$) .executor(exec) //!ExecutorX.ofVertxContext(vertx) .buildAsync((id, ex) -> $name$().maybe(id) .map(v -> v.map($TYPE$X::fromAsJson) .orElse(null)) .toCompletionStage().toCompletableFuture());" description="caffiene Async Cache by ID" toReformat="true" toShortenFQNames="true"> | |
<variable name="cache" expression="concat(name,"s")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="SPEC" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="name" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="imAsyncLoadEntity" value="io.vertx.core.Future<java.util.Optional<$TYPE$X.DataJson>> async$TYPE$(long id) { return io.vertx.core.Future.fromCompletionStage($CACHE$.get(id)) .map(java.util.Optional::ofNullable); } io.vertx.core.Future<java.util.Optional<$TYPE$X.DataJson>> async$TYPE$(com.medtreehealth.vertx.api.Entry entry) { return async$TYPE$(entry.id()) .map(v->v.filter(x->x.sameVersion(entry.version()))); }" description="caffiene Async Cache load Vertx Future" toReformat="true" toShortenFQNames="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="CACHE" expression="concat(camelCase(TYPE),"s")" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imPublish" value="@Override public io.vertx.core.Future<$TYPE$> $NAME$Revoke(Entry $NAME$, $ABLE$ man) { return ctx.audit$TYPE$RevokeOf($NAME$, man, cx -> Entities.$LOAD$(cx, null, man) .flatMap(p -> p.revoke$TYPE$($NAME$)) ); } @Override public io.vertx.core.Future<$TYPE$> $NAME$Update($ARGS$, Entry $NAME$, $ABLE$ man) { return ctx.audit$TYPE$UpdateOf($ARGS$, $NAME$, man, cx -> Entities.$LOAD$(cx, null, man) .flatMap(p -> p.update$TYPE$($ARGS$,$NAME$)) ); } @Override public io.vertx.core.Future<$TYPE$> $NAME$Publish(Entry $NAME$, $ABLE$ man) { return ctx.audit$TYPE$PublishOf(tenant, man, cx -> Entities.$LOAD$(cx, null, man) .flatMap(p -> p.publish$TYPE$($NAME$)) ); } @Override public io.vertx.core.Future<$TYPE$> $NAME$CancelPublish(Entry $NAME$, $ABLE$ man) { return ctx.audit$TYPE$CancelPublishOf($NAME$, man, cx -> Entities.$LOAD$(cx, null, man) .flatMap(p -> p.cancelPublish$TYPE$($NAME$)) ); } @Override public io.vertx.core.Future<$TYPE$> $NAME$Drop(Entry $NAME$, $ABLE$ man) { return ctx.audit$TYPE$DropOf($NAME$, man, cx -> Entities.$LOAD$(cx, null, man) .flatMap(p -> p.drop$TYPE$($NAME$)) ); }" description="Publishable method template" toReformat="true" toShortenFQNames="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="true" /> | |
<variable name="ABLE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="LOAD" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="ARGS" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imAct" value=" @Override public io.vertx.core.Future<$T$> $N$Register(com.medtreehealth.services.foundation.api.user.actor.User user, $R$ register, com.medtreehealth.services.foundation.api.user.actor.User actor) { return ctx.audit$T$RegisterOf(user,register,actor,cx->cx.register$T$(user,register,actor)); } @Override public io.vertx.core.Future<java.util.Optional<$T$>> $N$Of(com.medtreehealth.services.foundation.api.user.actor.User user) { return ctx.$N$().maybe(t -> t.user().eq(user.id())); } @Override public io.vertx.core.Future<Void> $N$Drop($T$ $N$, @org.jetbrains.annotations.Nullable io.vertx.core.json.JsonObject payload, com.medtreehealth.services.foundation.api.user.actor.User actor) { return ctx.audit$T$DropOf($N$,payload,actor,cx->cx.drop$T$($N$,payload,actor)); } @Override public io.vertx.core.Future<java.util.Optional<$T$>> $N$OfId(long id) { return ctx.$N$().maybe(id); }" description="sys actor ablity methods implement" toReformat="true" toShortenFQNames="true"> | |
<variable name="T" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="N" expression="camelCase(T)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="R" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imCacheWithLoad" value=" final AsyncLoadingCache<Long, $TYPE$X.DataJson> $CACHE$=com.github.benmanes.caffeine.cache.Caffeine.from($CACHE$) .executor(exec) //ExecutorX.ofVertxContext(vertx) //! move code to conturctor .buildAsync((id, ex) -> $name$().maybe(id) .map(v -> v.map($TYPE$X::fromAsJson) .orElse(null)) .toCompletionStage().toCompletableFuture()); io.vertx.core.Future<java.util.Optional<$TYPE$X.DataJson>> async$TYPE$(long id) { return io.vertx.core.Future.fromCompletionStage($CACHE$.get(id)) .map(java.util.Optional::ofNullable);; } io.vertx.core.Future<java.util.Optional<$TYPE$X.DataJson>> async$TYPE$(com.medtreehealth.vertx.api.Entry entry) { return async$TYPE$(entry.id()) .map(v->v.filter(x->x.sameVersion(entry.version()))); }" description="caffiene Async Cache load Vertx Future (also with Cache)" toReformat="true" toShortenFQNames="true"> | |
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="CACHE" expression="concat(name,"s")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="name" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLStatus" value="status tinyint not null default 0 comment '状态:0 草稿 1 发布 2 下架'" description="MySQL DDL Publishable" toReformat="true" toShortenFQNames="true"> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLProfile" value=" profile json not null comment '档案'," description="MySQL DDL Profile" toReformat="true" toShortenFQNames="true"> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLConfigure" value="configure json not null comment '配置信息'," description="MySQL DDL Configure" toReformat="true" toShortenFQNames="true"> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLNameUnique" value="name varchar(63) not null unique comment '唯一名称', unique udx_$TABLE$_$KIND$_$MODULE$_name_unique (name, removed)," description="MySQL DDL Name.Unique" toReformat="true" toShortenFQNames="true"> | |
<variable name="TABLE" expression="groovyScript("_1.minus('.ddl.mysql')",fileNameWithoutExtension())" defaultValue="" alwaysStopAt="false" /> | |
<variable name="KIND" expression="enum("able","actor","rec")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="MODULE" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLRefer" value="$NAME$ bigint not null comment '$END$'," description="MySQL DDL Refer entity" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLFlag32" value="$NAME$ int not null default 0 comment 'FALG $END$'," description="MySQL DDL flag" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLFlag64" value="$NAME$ bigint not null default 0 comment 'FALG $END$'," description="MySQL DDL flag" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLBoolean" value=" $NAME$ boolean not null default $DEF$ comment '$END$'," description="MySQL DDL boolean" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="DEF" expression="enum("true","false")" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="ddlMySQLString" value="$NAME$ varchar($LEN$) not null comment '$END$', " description="MySQL DDL String" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="LEN" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="SQL_CODE_MYSQL" value="true" /> | |
</context> | |
</template> | |
<template name="defConfig" value="@com.medtreehealth.vertx.api.util.ConfigureX.Configure public interface Config { @com.medtreehealth.vertx.api.util.ConfigureX.DefaultEmpty String $OBJ_CACHES = "caches"; @com.medtreehealth.vertx.api.util.ConfigureX.DefaultValue("\"initialCapacity=5,maximumSize=4096,expireAfterWrite=5m\"") String $REF_CACHES_$STR_ENTITY = "entities"; }" description="config template" toReformat="true" toShortenFQNames="true"> | |
<variable name="REF_CACHES_" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieActor" value=" record $name$( $CTX$ ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$X.DataJson data ) implements Entities<$ELE$, $ELE$X.DataJson, $name$> { static $name$ of( $CTX$ ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$X.DataJson data){ return new $name$(ctx,tx,data); } com.medtreehealth.vertx.api.Identified actor() { return data::user; } @Override public $name$ $it() { return this; } @Override public java.util.function.Function<$ELE$, $ELE$X.DataJson> $toJson() { return $ELE$X::fromAsJson; } @Override public java.util.function.Function<$ELE$X.DataJson, $name$> $ctor() { return d -> new $name$(ctx, tx, d); } }" description="Actor or ability entity template" toReformat="true" toShortenFQNames="true"> | |
<variable name="CTX" expression="completeSmart()" defaultValue="Context" alwaysStopAt="true" /> | |
<variable name="ELE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="name" expression="camelCase(ELE)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="iet" value="$API$" description="test for expand" toReformat="true" toShortenFQNames="true"> | |
<variable name="API" expression="groovyScript("_1.substring(0,_1.lastIndexOf(File.separator)).replace('verticle','api').replace(File.separator,'.')",fileRelativePath())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imCtxEntAbleFac" value="io.vertx.core.Future<$ENT$> $ENT$( @Nullable io.vertx.sqlclient.SqlConnection tx, com.medtreehealth.vertx.api.Entry entry) { return $ENT$(tx) .maybe(entry) .map(com.medtreehealth.vertx.api.util.FuncX.required(errors::$CODE$)) .map(p->new $ENT$(this,tx,$API$.ability.$ENTITY$.fromAsJson(p))) ; } io.vertx.core.Future<$ENT$> $ENT$(@Nullable io.vertx.sqlclient.SqlConnection tx, long id) { return $ENT$(tx) .maybe(id) .map(com.medtreehealth.vertx.api.util.FuncX.required(errors::$CODE$)) .map(p->new $ENT$(this,tx,$API$.ability.$ENTITY$.fromAsJson(p))) ; }" description="impl of able entity factory segment in Context" toReformat="true" toShortenFQNames="true"> | |
<variable name="ENT" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="CODE" expression="completeSmart()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="ENTITY" expression="concat(capitalize(ENT),"X")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="API" expression="groovyScript("_1.substring(0,_1.lastIndexOf(File.separator)).replace('verticle','api').replace(File.separator,'.')",fileRelativePath())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="imCtxEntRecFac" value="io.vertx.core.Future<$ENT$> $ENT$( @Nullable io.vertx.sqlclient.SqlConnection tx, com.medtreehealth.vertx.api.Entry entry) { return $ENT$(tx) .maybe(entry) .map(com.medtreehealth.vertx.api.util.FuncX.required(errors::$CODE$)) .map(p->new $ENT$(this,tx,$API$.record.$ENTITY$.fromAsJson(p))) ; } io.vertx.core.Future<$ENT$> $ENT$(@Nullable io.vertx.sqlclient.SqlConnection tx, long id) { return $ENT$(tx) .maybe(id) .map(com.medtreehealth.vertx.api.util.FuncX.required(errors::$CODE$)) .map(p->new $ENT$(this,tx,$API$.record.$ENTITY$.fromAsJson(p))) ; }" description="impl of record entity factory segment in Context" toReformat="true" toShortenFQNames="true"> | |
<variable name="ENT" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="CODE" expression="completeSmart()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="ENTITY" expression="concat(capitalize(ENT),"X")" defaultValue="" alwaysStopAt="false" /> | |
<variable name="API" expression="groovyScript("_1.substring(0,_1.lastIndexOf(File.separator)).replace('verticle','api').replace(File.separator,'.')",fileRelativePath())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieVerticleProxy" value="@lombok.extern.slf4j.Slf4j @lombok.experimental.Accessors(fluent = true) @com.google.auto.service.AutoService(com.medtreehealth.vertx.core.verticle.VerticleX.class) public class $NAME$ extends com.medtreehealth.vertx.core.verticle.VerticleX.SingularMySQLProxiesBinder<$DOMAIN$> implements com.medtreehealth.vertx.core.verticle.VerticleX.ReDeployable, com.medtreehealth.vertx.core.verticle.VerticleX.ProxyManager { @lombok.Getter final java.util.Map<Class<? extends com.medtreehealth.vertx.api.Sys>, com.medtreehealth.vertx.api.Sys> proxies = new java.util.HashMap<>(); public $NAME$() {//for SPI super("",JsonObject.of()); } public $NAME$(@lombok.NonNull io.vertx.core.json.JsonObject config) { super("$config$", config); log.info("launching {}", this.getClass()); } @Override protected $DOMAIN$ system() { return new $DOMAIN$Impl( vertx, sql(), dialect(), conf().value(), proxy($END$) ); } }" description="Verticle with proxy manager template" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="DOMAIN" expression="groovyScript("_1.minus('Verticle')",NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="config" expression="camelCase(DOMAIN)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieSysWeb" value="public class $NAME$ extends com.medtreehealth.vertx.core.verticle.ServiceX.WebApi implements $TYPE$ { final com.medtreehealth.vertx.core.verticle.VerticleX.Configurator conf; final java.util.function.Supplier<com.medtreehealth.vertx.core.component.AuthenticatorX> authenticator; final java.util.function.Supplier<com.medtreehealth.vertx.core.component.AuthenticatorX.TokenGenerator> tokenizer; final com.medtreehealth.vertx.core.verticle.VerticleX.ProxyManager proxies; $NAME$(io.vertx.core.Vertx vertx, io.vertx.ext.web.Router router, com.medtreehealth.vertx.core.verticle.VerticleX.Configurator conf, java.util.function.Supplier<com.medtreehealth.vertx.core.component.AuthenticatorX> authenticator, java.util.function.Supplier<com.medtreehealth.vertx.core.component.AuthenticatorX.TokenGenerator> tokenizer, com.medtreehealth.vertx.core.verticle.VerticleX.ProxyManager proxies ) { super(vertx, router); this.conf=conf; this.authenticator=authenticator; this.tokenizer=tokenizer; this.proxies=proxies; com.medtreehealth.vertx.core.utils.RouterX.of(conf.value(),proxies,authenticator,tokenizer,router); } @Override public io.vertx.core.Future<Void> serve() { return io.vertx.core.Future.future(p->{ //! when launch inject all proxies $END$ p.complete(); }); } @Override public io.vertx.core.Future<Void> dispose() { return io.vertx.core.Future.succeededFuture(); } } " description="sys implement for web api service" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="TYPE" expression="groovyScript("_1.minus('Impl')",NAME)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieVerticleWeb" value="@lombok.extern.slf4j.Slf4j @lombok.experimental.Accessors(fluent = true) @com.google.auto.service.AutoService(com.medtreehealth.vertx.core.verticle.VerticleX.class) public class $NAME$ extends com.medtreehealth.vertx.core.verticle.VerticleX.Http implements com.medtreehealth.vertx.core.verticle.VerticleX.ProxyManager { @lombok.Getter final java.util.Map<Class<? extends com.medtreehealth.vertx.api.Sys>, com.medtreehealth.vertx.api.Sys> proxies = new java.util.concurrent.ConcurrentHashMap<>(); public $NAME$() { //for SPI super("",JsonObject.of()); } public $NAME$(@lombok.NonNull io.vertx.core.json.JsonObject config) { super("$config$", config); } private $DOMAIN$Impl service; @Override public @lombok.NonNull io.vertx.core.Future<Void> serve() { return service.serve(); } @Override public @lombok.NonNull io.vertx.core.Future<Void> halt() { return service.dispose() .flatMap($ -> closeProxies()) .mapEmpty(); } @Override protected io.vertx.core.Future<Void> register(io.vertx.ext.web.Router router) { return io.vertx.core.Future.future(p -> { service = new $DOMAIN$Impl(vertx, router, conf(), this::authenticator, () -> this.tokenGenerator() .orElseThrow(() -> new IllegalStateException("Token generator required")), this $END$); p.complete(); }); } } " description="Verticle template for http web service" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="DOMAIN" expression="groovyScript("_1.minus('Verticle')",NAME)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="config" expression="camelCase(DOMAIN)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="defVal" value=" @com.medtreehealth.vertx.api.util.annotation.VertX(withRow = false) public interface $NAME$ extends com.medtreehealth.vertx.api.Element { @Override default Class<? extends $NAME$> type() { return $NAME$.class; } } " description="Value without validation" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieEntitiesStore" value="default $XUT$.XStore $NAM$(){ return store($XUT$::store); }" description="units Entities default store" toReformat="true" toShortenFQNames="true"> | |
<variable name="XUT" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="NAM" expression="decapitalize(regularExpression(XUT, "^(.*)X$", "$1s"))" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
<template name="ieEntityDelegate" value="record $name$( Context ctx, io.vertx.sqlclient.SqlConnection tx, @lombok.experimental.Delegate(types=$ELE$.class) $ELE$X.DataJson data ) implements Entities<$ELE$, $ELE$X.DataJson, $name$> { static $name$ of( Context ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$X.DataJson data){ return new $name$(ctx,tx,data); } static $name$ of( Context ctx, io.vertx.sqlclient.SqlConnection tx, $ELE$ data){ return new $name$(ctx,tx,$ELE$X.fromAsJson(data)); } @Override public $name$ $it() { return this; } @Override public java.util.function.Function<$ELE$, $ELE$X.DataJson> $toJson() { return $ELE$X::fromAsJson; } @Override public java.util.function.Function<$ELE$X.DataJson, $name$> $ctor() { return d -> new $name$(ctx, tx, d); } }" description="Entity template with Delegate" toReformat="true" toShortenFQNames="true"> | |
<variable name="ELE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="name" expression="camelCase(ELE)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> | |
</templateSet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment