diff options
Diffstat (limited to 'ms/sliboot/src/main/templates/api.mustache')
-rw-r--r-- | ms/sliboot/src/main/templates/api.mustache | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/ms/sliboot/src/main/templates/api.mustache b/ms/sliboot/src/main/templates/api.mustache index c28642cf..91483eda 100644 --- a/ms/sliboot/src/main/templates/api.mustache +++ b/ms/sliboot/src/main/templates/api.mustache @@ -7,15 +7,11 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} -{{#jdk8-no-delegate}} - import com.fasterxml.jackson.databind.ObjectMapper; -{{/jdk8-no-delegate}} +import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.*; -{{#jdk8-no-delegate}} - import org.slf4j.Logger; - import org.slf4j.LoggerFactory; - import org.springframework.http.HttpStatus; -{{/jdk8-no-delegate}} +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; {{#useBeanValidation}} import org.springframework.validation.annotation.Validated; @@ -30,33 +26,37 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import org.onap.ccsdk.apps.services.RestException; -{{#jdk8-no-delegate}} - import javax.servlet.http.HttpServletRequest; -{{/jdk8-no-delegate}} + +{{#jakarta}} +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +{{/jakarta}} +{{^jakarta}} +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +{{/jakarta}} {{#useBeanValidation}} - import javax.validation.Valid; - import javax.validation.constraints.*; +{{#jakarta}} +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} +import javax.validation.Valid; +import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} -{{#jdk8-no-delegate}} - import java.io.IOException; -{{/jdk8-no-delegate}} +import java.io.IOException; import java.util.List; -{{#jdk8-no-delegate}} - import java.util.Optional; -{{/jdk8-no-delegate}} -{{^jdk8-no-delegate}} - {{#useOptional}} - import java.util.Optional; - {{/useOptional}} -{{/jdk8-no-delegate}} +import java.util.Optional; {{#async}} - import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}}; +import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}}; {{/async}} {{>generatedAnnotation}} @Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API") {{#operations}} public interface {{classname}} { - {{#jdk8}} {{^isDelegate}} Logger log = LoggerFactory.getLogger({{classname}}.class); @@ -76,7 +76,6 @@ import java.util.List; {{#isDelegate}} {{classname}}Delegate getDelegate(); {{/isDelegate}} - {{/jdk8}} {{#operation}} @ApiOperation(value = "{{{summary}}}", nickname = "{{{operationId}}}", notes = "{{{notes}}}"{{#returnBaseType}}, response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { @@ -101,7 +100,7 @@ import java.util.List; produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} method = RequestMethod.{{httpMethod}}) - {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} throws RestException { + default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) throws RestException { {{#delegate-method}} return {{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); } @@ -129,7 +128,7 @@ import java.util.List; {{#isDelegate}} return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{/isDelegate}} - }{{/jdk8}} + } {{/operation}} } |