private def converter[U : TypeTag]()

in driver/src/main/scala/com/datastax/spark/connector/mapper/GettableDataToMappedTypeConverter.scala [91:130]


  private def converter[U : TypeTag](columnType: ColumnType[_]): TypeConverter[U] = {
    /*
    This method does not immediately call `TypeConverter.forType`, because `forType` doesn't know
    the Cassandra `ColumnType` and therefore it can't instantiate appropriate type converters for
    Cassandra user-defined-types, which could be nested. Therefore, for types that can nest other types
    i.e. collections, options or UDTs, we make sure to use this method for any needed nested converters.
    E.g. for a list type, we recursively call this method to get the converter for the
    list items and then we call `TypeConverter.forType` to get a proper converter for lists.
    */
    val tpe = typeTag[U].tpe
    (columnType, tpe) match {
      case (argColumnType, TypeRef(_, Symbols.OptionSymbol, List(argScalaType))) =>
        val argConverter = converter(argColumnType, argScalaType)
        TypeConverter.forType[U](Seq(argConverter))

      case (struct: StructDef, _) =>
        implicit val cm: ColumnMapper[U] = columnMapper[U]
        new GettableDataToMappedTypeConverter[U](struct, struct.columnRefs)

      case (ListType(argColumnType, _), TypeRef(_, _, List(argScalaType))) =>
        val argConverter = converter(argColumnType, argScalaType)
        TypeConverter.forType[U](Seq(argConverter))

      case (VectorType(argColumnType, _), TypeRef(_, _, List(argScalaType))) =>
        val argConverter = converter(argColumnType, argScalaType)
        TypeConverter.forType[U](Seq(argConverter))

      case (SetType(argColumnType, _), TypeRef(_, _, List(argScalaType))) =>
        val argConverter = converter(argColumnType, argScalaType)
        TypeConverter.forType[U](Seq(argConverter))

      case (MapType(keyColumnType, valueColumnType, _), TypeRef(_, _, List(keyScalaType, valueScalaType))) =>
        val keyConverter = converter(keyColumnType, keyScalaType)
        val valueConverter = converter(valueColumnType, valueScalaType)
        TypeConverter.forType[U](Seq(keyConverter, valueConverter))

      case (_, _) =>
        TypeConverter.forType[U]
    }
  }