All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.connect.kafka.rest.KotshiKafkaRestJsonAdapterFactory.kt Maven / Gradle / Ivy

There is a newer version: 5.35.3.0
Show newest version
// Code generated by Kotshi. Do not edit.
@file:Suppress(
  "EXPERIMENTAL_IS_NOT_ENABLED",
  "REDUNDANT_PROJECTION",
)

package org.http4k.connect.kafka.rest

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types.getRawType
import java.lang.Class
import java.lang.reflect.Type
import kotlin.Annotation
import kotlin.Nothing
import kotlin.OptIn
import kotlin.Suppress
import kotlin.collections.Set
import org.http4k.connect.kafka.rest.v2.action.KotshiNewConsumerJsonAdapter
import org.http4k.connect.kafka.rest.v2.action.KotshiPartitionJsonAdapter
import org.http4k.connect.kafka.rest.v2.action.KotshiProducedMessagesJsonAdapter
import org.http4k.connect.kafka.rest.v2.action.KotshiReplicaJsonAdapter
import org.http4k.connect.kafka.rest.v2.action.NewConsumer
import org.http4k.connect.kafka.rest.v2.action.Partition
import org.http4k.connect.kafka.rest.v2.action.ProducedMessages
import org.http4k.connect.kafka.rest.v2.action.Replica
import org.http4k.connect.kafka.rest.v2.model.CommitOffset
import org.http4k.connect.kafka.rest.v2.model.CommitOffsetsSet
import org.http4k.connect.kafka.rest.v2.model.Consumer
import org.http4k.connect.kafka.rest.v2.model.GetOffsetsRequest
import org.http4k.connect.kafka.rest.v2.model.KotshiCommitOffsetJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiCommitOffsetsSetJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiConsumerJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiGetOffsetsRequestJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiPartitionOffsetJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiPartitionOffsetRequestJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiSeekOffsetJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiSeekOffsetsSetJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiSubscriptionJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.KotshiTopicRecordJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.PartitionOffset
import org.http4k.connect.kafka.rest.v2.model.PartitionOffsetRequest
import org.http4k.connect.kafka.rest.v2.model.SeekOffset
import org.http4k.connect.kafka.rest.v2.model.SeekOffsetsSet
import org.http4k.connect.kafka.rest.v2.model.Subscription
import org.http4k.connect.kafka.rest.v2.model.TopicRecord
import org.http4k.connect.kafka.rest.v3.action.Header
import org.http4k.connect.kafka.rest.v3.action.KafkaPartition
import org.http4k.connect.kafka.rest.v3.action.KafkaPartitionList
import org.http4k.connect.kafka.rest.v3.action.KafkaTopic
import org.http4k.connect.kafka.rest.v3.action.KafkaTopicList
import org.http4k.connect.kafka.rest.v3.action.KotshiHeaderJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.KotshiKafkaPartitionJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.KotshiKafkaPartitionListJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.KotshiKafkaTopicJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.KotshiKafkaTopicListJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.KotshiProducedRecordDataJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.KotshiProducedRecordJsonAdapter
import org.http4k.connect.kafka.rest.v3.action.ProducedRecord
import org.http4k.connect.kafka.rest.v3.action.ProducedRecordData
import org.http4k.connect.kafka.rest.v3.model.KotshiMetadataJsonAdapter
import org.http4k.connect.kafka.rest.v3.model.KotshiRelationJsonAdapter
import org.http4k.connect.kafka.rest.v3.model.Metadata
import org.http4k.connect.kafka.rest.v3.model.Relation
import se.ansman.kotshi.InternalKotshiApi
import se.ansman.kotshi.KotshiUtils.typeArgumentsOrFail
import org.http4k.connect.kafka.rest.v2.model.KotshiRecordJsonAdapter as V2ModelKotshiRecordJsonAdapter
import org.http4k.connect.kafka.rest.v2.model.Record as V2ModelRecord
import org.http4k.connect.kafka.rest.v3.model.KotshiRecordJsonAdapter as V3ModelKotshiRecordJsonAdapter
import org.http4k.connect.kafka.rest.v3.model.Record as V3ModelRecord

@OptIn(InternalKotshiApi::class)
internal object KotshiKafkaRestJsonAdapterFactory : JsonAdapter.Factory {
  override fun create(
    type: Type,
    annotations: Set,
    moshi: Moshi,
  ): JsonAdapter<*>? {
    val rawType: Class<*> = getRawType(type)
    if (annotations.isNotEmpty()) return null

    return when (rawType) {
      NewConsumer::class.java ->
          KotshiNewConsumerJsonAdapter(
            moshi = moshi
          )
      Partition::class.java ->
          KotshiPartitionJsonAdapter(
            moshi = moshi
          )
      ProducedMessages::class.java ->
          KotshiProducedMessagesJsonAdapter(
            moshi = moshi
          )
      Replica::class.java ->
          KotshiReplicaJsonAdapter(
            moshi = moshi
          )
      CommitOffset::class.java ->
          KotshiCommitOffsetJsonAdapter(
            moshi = moshi
          )
      CommitOffsetsSet::class.java ->
          KotshiCommitOffsetsSetJsonAdapter(
            moshi = moshi
          )
      Consumer::class.java ->
          KotshiConsumerJsonAdapter(
            moshi = moshi
          )
      GetOffsetsRequest::class.java ->
          KotshiGetOffsetsRequestJsonAdapter(
            moshi = moshi
          )
      PartitionOffset::class.java ->
          KotshiPartitionOffsetJsonAdapter(
            moshi = moshi
          )
      PartitionOffsetRequest::class.java ->
          KotshiPartitionOffsetRequestJsonAdapter(
            moshi = moshi
          )
      V2ModelRecord::class.java ->
          V2ModelKotshiRecordJsonAdapter(
            moshi = moshi,
            types = type.typeArgumentsOrFail
          )
      SeekOffset::class.java ->
          KotshiSeekOffsetJsonAdapter(
            moshi = moshi
          )
      SeekOffsetsSet::class.java ->
          KotshiSeekOffsetsSetJsonAdapter(
            moshi = moshi
          )
      Subscription::class.java ->
          KotshiSubscriptionJsonAdapter(
            moshi = moshi
          )
      TopicRecord::class.java ->
          KotshiTopicRecordJsonAdapter(
            moshi = moshi
          )
      Header::class.java ->
          KotshiHeaderJsonAdapter()
      KafkaPartition::class.java ->
          KotshiKafkaPartitionJsonAdapter(
            moshi = moshi
          )
      KafkaPartitionList::class.java ->
          KotshiKafkaPartitionListJsonAdapter(
            moshi = moshi
          )
      KafkaTopic::class.java ->
          KotshiKafkaTopicJsonAdapter(
            moshi = moshi
          )
      KafkaTopicList::class.java ->
          KotshiKafkaTopicListJsonAdapter(
            moshi = moshi
          )
      ProducedRecordData::class.java ->
          KotshiProducedRecordDataJsonAdapter(
            moshi = moshi
          )
      ProducedRecord::class.java ->
          KotshiProducedRecordJsonAdapter(
            moshi = moshi
          )
      Metadata::class.java ->
          KotshiMetadataJsonAdapter(
            moshi = moshi
          )
      V3ModelRecord::class.java ->
          V3ModelKotshiRecordJsonAdapter(
            moshi = moshi
          )
      Relation::class.java ->
          KotshiRelationJsonAdapter(
            moshi = moshi
          )
      else -> null
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy