in elitzur-avro/src/main/scala/com/spotify/elitzur/converters/avro/dynamic/DynamicAccessorCompanion.scala [40:52]
private def parseUnsafe(v: Any): Any = companion.parse(v.asInstanceOf[T])
@transient private lazy val preParserProcessor: Any => Any =
typeOf[T] match {
// String in Avro can be stored as org.apache.avro.util.Utf8 (a subclass of Charsequence)
// which cannot be cast to String as-is. The toString method is added to ensure casting.
case t if t =:= typeOf[String] => (v: Any) => v.toString
// ByteBuffer in Avro to be converted into Array[Byte] which is the the format that Validation
// type expects the input the input to be in.
case t if t =:= typeOf[Array[Byte]] =>
(v: Any) => byteBufferToByteArray(v.asInstanceOf[java.nio.ByteBuffer])
case _ => (v: Any) => v
}