From c92dc50f3f2e272423bcf9f78bf930202a5ad0b4 Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 11 Apr 2023 00:45:37 +0200 Subject: [PATCH] Converted GenerateEpcQrCodeRequest to data class and all it's properties to val --- .../rest/dto/GenerateEpcQrCodeRequest.kt | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt index 9c04d4b..b1b8a08 100644 --- a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt +++ b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt @@ -8,55 +8,58 @@ import org.eclipse.microprofile.openapi.annotations.parameters.Parameter import javax.ws.rs.DefaultValue import javax.ws.rs.QueryParam - -class GenerateEpcQrCodeRequest { +data class GenerateEpcQrCodeRequest( @QueryParam("receiverName") @Parameter(description = "The name of the receiver of this money transfer (that is in most cases your name or your company's name)", required = true) @Schema(description = "The name of the receiver of this money transfer (that is in most cases your name or your company's name)", required = true) - var receiverName: String = "" + val receiverName: String, @QueryParam("iban") @Parameter(description = "Receiver's IBAN", required = true) @Schema(description = "Receiver's IBAN", required = true) - var iban: String = "" + val iban: String, @QueryParam("bic") @Parameter(description = "Receiver's BIC (optional, only required for transfers to foreign countries)", required = false) @Schema(description = "Receiver's BIC (optional, only required for transfers to foreign countries)", required = false) - var bic: String? = null + val bic: String? = null, @QueryParam("amount") @Parameter(description = "The amount to transfer (by standard optional, but highly recommended)", required = false) @Schema(description = "The amount to transfer (by standard optional, but highly recommended)", required = false) - var amount: String? = null + val amount: String? = null, @QueryParam("reference") @Parameter(description = "The reference or usage of this money transfer", required = false) @Schema(description = "The reference or usage of this money transfer", required = false) - var reference: String? = null + val reference: String? = null, @QueryParam("noteToUser") @Parameter(description = "An optional note that should be displayed to user (not implemented by all decoding applications)", required = false) @Schema(description = "An optional note that should be displayed to user (not implemented by all decoding applications)", required = false) - var noteToUser: String? = null + val noteToUser: String? = null, @DefaultValue("" + EpcQrCode.DefaultHeightAndWidth) @QueryParam("imageHeightAndWidth") @Parameter(description = "Height and width of the returned QR code", required = false) @Schema(description = "Height and width of the returned QR code", defaultValue = "" + EpcQrCode.DefaultHeightAndWidth, required = false) - var imageHeightAndWidth: Int = EpcQrCode.DefaultHeightAndWidth + val imageHeightAndWidth: Int = EpcQrCode.DefaultHeightAndWidth, @DefaultValue("PNG") @QueryParam("imageFormat") @Parameter(description = "The format of the returned QR code image", required = false) @Schema(description = "The format of the returned QR code image", defaultValue = "PNG", required = false) - var imageFormat: ImageFormat = ImageFormat.PNG + val imageFormat: ImageFormat = ImageFormat.PNG, @DefaultValue("UTF_8") @QueryParam("encoding") @Parameter(description = "The charset used for encoding", required = false) @Schema(description = "The charset used for encoding", defaultValue = "UTF_8", required = false) - var encoding: EpcQrCodeCharacterSet = EpcQrCodeCharacterSet.UTF_8 + val encoding: EpcQrCodeCharacterSet = EpcQrCodeCharacterSet.UTF_8 + +) { + + internal constructor() : this("", "") // for object deserializers // TODO: why isn't Jackson being used to deserialize this class, KotlinModule would be able to deserialize it without default constructor } \ No newline at end of file