Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import org.apache.pulsar.client.api.Schema
import org.apache.pulsar.client.impl.schema.SchemaInfoImpl
import org.apache.pulsar.common.schema.{SchemaInfo, SchemaType}

import java.nio.charset.StandardCharsets
import scala.annotation.implicitNotFound
import scala.reflect.{ClassTag, classTag}

/**
* Automatic MessageWriter and MessageReader derivation
Expand All @@ -30,7 +32,7 @@ package object circe {

@implicitNotFound(
"No Encoder for type ${T} found. Use 'import io.circe.generic.auto._' or provide an implicit Encoder instance ")
implicit def circeSchema[T: Manifest](implicit
implicit def circeSchema[T: ClassTag](implicit
encoder: Encoder[T],
decoder: Decoder[T],
printer: Json => String = Printer.noSpaces.print): Schema[T] = new Schema[T] {
Expand All @@ -40,7 +42,7 @@ package object circe {
io.circe.jawn.decode[T](new String(bytes, StandardCharsets.UTF_8)).fold(throw _, identity)
override def getSchemaInfo: SchemaInfo = {
SchemaInfoImpl.builder()
.name(manifest[T].runtimeClass.getCanonicalName)
.name(classTag[T].runtimeClass.getCanonicalName)
.`type`(SchemaType.BYTES)
.schema(Array.empty[Byte])
.build()
Expand Down
Loading