From d8e61872267443c7ad8d2d5d9f7b3076df8eff3c Mon Sep 17 00:00:00 2001 From: Ivan Garcia Sainz-Aja Date: Sat, 4 Mar 2023 07:21:53 +0100 Subject: [PATCH] adds @javax.annotation.Generated --- .../consumer/imperative/Consumer.java.hbs | 1 + .../consumer/imperative/IService.java.hbs | 1 + .../consumer/reactive/Consumer.java.hbs | 1 + .../consumer/reactive/IService.java.hbs | 2 +- .../producer/IProducer.java.hbs | 1 + .../producer/mocks/ProducerCaptor.java.hbs | 1 + .../producer/mocks/ProducerInMemoryContext.java.hbs | 1 + .../producer/outbox/jdbc/Producer.java.hbs | 1 + .../producer/outbox/mongodb/Producer.java.hbs | 1 + .../producer/outbox/none/Producer.java.hbs | 1 + .../sdk/templating/CustomHandlebarsHelpers.java | 8 ++++++++ .../io/zenwave360/sdk/templating/handlebars-test.hbs | 2 ++ 12 files changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/Consumer.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/Consumer.java.hbs index 545861bb..ca18fdda 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/Consumer.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/Consumer.java.hbs @@ -23,6 +23,7 @@ import {{modelPackage}}.*; {{#assign "messageCount"}}{{size operation.x--messages}}{{/assign~}} @Component("{{operation.x--operationIdKebabCase}}") +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class {{consumerName operation.x--operationIdCamelCase}} implements Consumer> { protected Logger log = LoggerFactory.getLogger(getClass()); diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/IService.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/IService.java.hbs index 77e25ddd..47b7152e 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/IService.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/imperative/IService.java.hbs @@ -11,6 +11,7 @@ import {{modelPackage}}.*; /** * {{asyncapi.description}} */ +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public interface {{serviceInterfaceName operation.x--operationIdCamelCase}} { {{#each operation.x--messages as |message|}} diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/Consumer.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/Consumer.java.hbs index a88aadb3..92a9cb4e 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/Consumer.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/Consumer.java.hbs @@ -18,6 +18,7 @@ import {{modelPackage}}.*; {{/if}} @Component("{{operation.x--operationIdKebabCase}}") +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class {{consumerName operation.x--operationIdCamelCase}} implements Consumer>> { protected Logger log = LoggerFactory.getLogger(getClass()); diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/IService.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/IService.java.hbs index d1485543..17e2fe4d 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/IService.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/consumer/reactive/IService.java.hbs @@ -11,7 +11,7 @@ import reactor.core.publisher.Mono; import {{modelPackage}}.*; {{/if}} - +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public interface {{serviceInterfaceName operation.x--operationIdCamelCase}} { {{#each operation.x--messages as |message|}} diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/IProducer.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/IProducer.java.hbs index cd14f34a..46c7c487 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/IProducer.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/IProducer.java.hbs @@ -7,6 +7,7 @@ import {{modelPackage}}.*; /** * {{asyncapi.description}} */ +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public interface I{{apiClassName}} { {{#each operations as |operation|}} diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerCaptor.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerCaptor.java.hbs index 434aa3bf..1d454129 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerCaptor.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerCaptor.java.hbs @@ -18,6 +18,7 @@ import {{modelPackage}}.*; /** * {{asyncapi.description}} */ +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class {{apiClassName}}Captor implements I{{apiClassName}} { protected Logger log = LoggerFactory.getLogger(getClass()); diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerInMemoryContext.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerInMemoryContext.java.hbs index 0c389811..65c5241e 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerInMemoryContext.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/mocks/ProducerInMemoryContext.java.hbs @@ -1,5 +1,6 @@ package {{producerApiPackage}}; +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class ProducerInMemoryContext { public static final ProducerInMemoryContext INSTANCE = new ProducerInMemoryContext(); diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/jdbc/Producer.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/jdbc/Producer.java.hbs index fa3f6213..ed8a3f9c 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/jdbc/Producer.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/jdbc/Producer.java.hbs @@ -24,6 +24,7 @@ import {{modelPackage}}.*; * {{asyncapi.description}} */ @Component +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class {{apiClassName}} implements I{{apiClassName}} { private Logger log = LoggerFactory.getLogger(getClass()); diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/mongodb/Producer.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/mongodb/Producer.java.hbs index efddad7a..8f5b9b7c 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/mongodb/Producer.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/mongodb/Producer.java.hbs @@ -30,6 +30,7 @@ import {{modelPackage}}.*; * {{asyncapi.description}} */ @Component +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class {{apiClassName}} implements I{{apiClassName}} { private Logger log = LoggerFactory.getLogger(getClass()); diff --git a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/none/Producer.java.hbs b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/none/Producer.java.hbs index ceed59e3..c1406761 100644 --- a/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/none/Producer.java.hbs +++ b/plugins/asyncapi-spring-cloud-streams3/src/main/resources/io/zenwave360/sdk/plugins/SpringCloudStream3Generator/producer/outbox/none/Producer.java.hbs @@ -19,6 +19,7 @@ import {{modelPackage}}.*; * {{asyncapi.description}} */ @Component +@javax.annotation.Generated(value = "io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin", date = "{{date}}") public class {{apiClassName}} implements I{{apiClassName}} { protected Logger log = LoggerFactory.getLogger(getClass()); diff --git a/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/templating/CustomHandlebarsHelpers.java b/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/templating/CustomHandlebarsHelpers.java index 5296932b..5ff44988 100644 --- a/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/templating/CustomHandlebarsHelpers.java +++ b/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/templating/CustomHandlebarsHelpers.java @@ -1,6 +1,11 @@ package io.zenwave360.sdk.templating; import java.io.IOException; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -17,6 +22,9 @@ public class CustomHandlebarsHelpers { + public static String date(Object props, Options options) { + return DateTimeFormatter.ISO_ZONED_DATE_TIME.format(OffsetDateTime.now()); + } public static String populateProperty(Map property, Options options) { String type = (String) property.get("type"); String format = (String) property.get("format"); diff --git a/zenwave-sdk-cli/src/test/resources/io/zenwave360/sdk/templating/handlebars-test.hbs b/zenwave-sdk-cli/src/test/resources/io/zenwave360/sdk/templating/handlebars-test.hbs index 7539a265..e0708613 100644 --- a/zenwave-sdk-cli/src/test/resources/io/zenwave360/sdk/templating/handlebars-test.hbs +++ b/zenwave-sdk-cli/src/test/resources/io/zenwave360/sdk/templating/handlebars-test.hbs @@ -11,6 +11,8 @@ asPackageFolder {{asPackageFolder "io.zenwave360.sdk.templating"}} Prefix{{.}}Suffix {{/joinWithTemplate}} +{{date}} + {{#if (eq var "assigned value")}} Inside if 1 {{/if}}