From 930c622d11953fe2edbeb12f4f428a45a462787c Mon Sep 17 00:00:00 2001 From: Vincent Leon Date: Sun, 9 Aug 2020 12:17:51 +0200 Subject: [PATCH] Issue #6830: Java server - Add getter to ApiException templates (#7150) --- .../resources/JavaJaxRS/ApiException.mustache | 26 +++++++++++++++++-- .../JavaJaxRS/resteasy/ApiException.mustache | 26 +++++++++++++++++-- .../JavaSpring/apiException.mustache | 26 +++++++++++++++++-- .../java-msf4j-server/ApiException.mustache | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- .../org/openapitools/api/ApiException.java | 26 +++++++++++++++++-- 13 files changed, 312 insertions(+), 26 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/ApiException.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/ApiException.mustache index f6161147700..74250662683 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/ApiException.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/ApiException.mustache @@ -1,10 +1,32 @@ package {{apiPackage}}; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ {{>generatedAnnotation}} -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/ApiException.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/ApiException.mustache index f6161147700..74250662683 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/ApiException.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/ApiException.mustache @@ -1,10 +1,32 @@ package {{apiPackage}}; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ {{>generatedAnnotation}} -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiException.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiException.mustache index f6161147700..74250662683 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiException.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiException.mustache @@ -1,10 +1,32 @@ package {{apiPackage}}; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ {{>generatedAnnotation}} -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/modules/openapi-generator/src/main/resources/java-msf4j-server/ApiException.mustache b/modules/openapi-generator/src/main/resources/java-msf4j-server/ApiException.mustache index f6161147700..74250662683 100644 --- a/modules/openapi-generator/src/main/resources/java-msf4j-server/ApiException.mustache +++ b/modules/openapi-generator/src/main/resources/java-msf4j-server/ApiException.mustache @@ -1,10 +1,32 @@ package {{apiPackage}}; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ {{>generatedAnnotation}} -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/ApiException.java index 469ebd8be8c..5eafa7b4caa 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaMSF4JServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/ApiException.java index cb188abf49e..342a4a4f17a 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java index cb188abf49e..342a4a4f17a 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/ApiException.java index 83ba300cd60..6e0c12c35ca 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/ApiException.java index 83ba300cd60..6e0c12c35ca 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/ApiException.java index cb188abf49e..342a4a4f17a 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/ApiException.java index cb188abf49e..342a4a4f17a 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/ApiException.java index cb188abf49e..342a4a4f17a 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/ApiException.java index cb188abf49e..342a4a4f17a 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/ApiException.java @@ -1,10 +1,32 @@ package org.openapitools.api; +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") -public class ApiException extends Exception{ +public class ApiException extends Exception { + + /** The HTTP status code. */ private int code; - public ApiException (int code, String msg) { + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { super(msg); this.code = code; } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + }