```class NullPrimitiveTypeAdapter { @FromJson ...
# announcements
m
Copy code
class NullPrimitiveTypeAdapter {
    @FromJson
    fun intFromJson(@NullableInt @Nullable value: Int?): Int = value ?: 0

    @ToJson
    @NullableInt
    fun toFromJson(value: Int): Int? = throw UnsupportedOperationException()

    @FromJson
    fun floatFromJson(@NullableFloat @Nullable value: Float?): Float = value ?: 0f

    @ToJson
    @NullableFloat fun floattoJson(value: Float): Float? = throw UnsupportedOperationException()
}

@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
annotation class Nullable

@Retention(AnnotationRetention.RUNTIME)
@JsonQualifier
annotation class NullableInt

@Retention(AnnotationRetention.RUNTIME)
@JsonQualifier
annotation class NullableFloat