
se.ansman.kotshi.JsonDefaultValue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
An annotations processor that generates Moshi adapters from Kotlin data classes
The newest version!
package se.ansman.kotshi
/**
* Annotation to be placed on enum an enum value or sealed class subclass to indicate that it is the default value if
* an unknown or missing entry is encountered.
*
* Only one value can be annotated.
*
* If no entry is annotated the adapter will throw an exception if an unknown value is encountered.
*
* Example:
* ```
* @JsonSerializable
* enum class SomeEnum {
* @JsonProperty(name = "some-value")
* SOME_VALUE,
* @JsonProperty(name = "some-other-value")
* SOME_OTHER_VALUE,
* @JsonDefaultValue
* UNKNOWN
* }
* ```
*/
@Target(AnnotationTarget.FIELD, AnnotationTarget.CLASS)
@MustBeDocumented
@Retention(AnnotationRetention.SOURCE)
annotation class JsonDefaultValue
© 2015 - 2025 Weber Informatics LLC | Privacy Policy