Document adding the KotlinJsonAdapterFactory.

If you add a custom Kotlin JsonAdapter factory after the KotlinJsonAdapterFactory, you're going to have a bad time.
This commit is contained in:
Eric Cochran
2017-10-29 05:38:48 +00:00
committed by GitHub
parent f06b43b2a4
commit 88ec00bcf4

View File

@@ -474,9 +474,10 @@ public final class BlackjackHand {
### Kotlin Support ### Kotlin Support
Kotlin classes work with Moshi out of the box, with the exception of annotations. If you need to annotate your Kotlin classes with an `@Json` annotation or otherwise, you will need to use the `moshi-kotlin` artifact, and set up Moshi to use its converter factory: Kotlin classes work with Moshi out of the box, with the exception of annotations. If you need to annotate your Kotlin classes with an `@Json` annotation or otherwise, you will need to use the `moshi-kotlin` artifact, and set up Moshi to use its converter factory. Add the KotlinJsonAdapterFactory last to allow other installed Kotlin type factories to be used, since factories are called in order.
```kotlin ```kotlin
val moshi = Moshi.Builder() val moshi = Moshi.Builder()
// Add any other JsonAdapter factories.
.add(KotlinJsonAdapterFactory()) .add(KotlinJsonAdapterFactory())
.build() .build()
``` ```