Matched JsonIgnore target and retention Jackson's @JsonIgnore values; suppressed compiler warnings; fixed using it on getters

This commit is contained in:
dankito 2024-08-19 21:12:32 +02:00
parent f13d417549
commit 68c2606a22
5 changed files with 12 additions and 3 deletions

View File

@ -93,7 +93,7 @@ kotlin {
jvmMain {
dependencies {
implementation("com.fasterxml.jackson.core:jackson-annotations:2.15.0")
compileOnly("com.fasterxml.jackson.core:jackson-annotations:2.15.0")
}
}
jvmTest { }

View File

@ -1,3 +1,9 @@
package net.codinux.banking.client.model.config
/**
* Annotation to be able to apply Jackson's @com.fasterxml.jackson.annotation.JsonIgnore in common module
*/
// match the target and retention settings of Jackson's JsonIgnore annotation
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD, AnnotationTarget.PROPERTY_GETTER)
@Retention(AnnotationRetention.RUNTIME)
expect annotation class JsonIgnore()

View File

@ -5,6 +5,7 @@ import net.codinux.banking.client.model.CustomerAccount
import net.codinux.banking.client.model.config.JsonIgnore
import net.codinux.banking.client.model.config.NoArgConstructor
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
@NoArgConstructor
open class GetAccountDataResponse(
val customer: CustomerAccount

View File

@ -3,6 +3,7 @@ package net.codinux.banking.client.model.tan
import net.codinux.banking.client.model.config.JsonIgnore
import net.codinux.banking.client.model.config.NoArgConstructor
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
@NoArgConstructor
open class FlickerCode(
val challengeHHD_UC: String,
@ -10,7 +11,7 @@ open class FlickerCode(
val decodingError: String? = null
) {
@JsonIgnore
@get:JsonIgnore
val decodingSuccessful: Boolean
get() = decodingError == null

View File

@ -3,6 +3,7 @@ package net.codinux.banking.client.model.tan
import net.codinux.banking.client.model.config.JsonIgnore
import net.codinux.banking.client.model.config.NoArgConstructor
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
@NoArgConstructor
open class TanImage(
val mimeType: String,
@ -10,7 +11,7 @@ open class TanImage(
val decodingError: String? = null
) {
@JsonIgnore
@get:JsonIgnore
val decodingSuccessful: Boolean
get() = decodingError == null