def genDefaultReadValue()

in scrooge-generator/src/main/scala/com/twitter/scrooge/backend/Generator.scala [443:467]


  def genDefaultReadValue(f: Field): CodeFragment =
    genDefaultFieldValue(f).getOrElse(genDefaultValue(f.fieldType))

  def genConstType(t: FunctionType): CodeFragment = {
    @scala.annotation.tailrec
    def getCode(t: FunctionType): String = t match {
      case at: AnnotatedFieldType => getCode(at.unwrap)
      case Void => "VOID"
      case TBool => "BOOL"
      case TByte => "BYTE"
      case TDouble => "DOUBLE"
      case TI16 => "I16"
      case TI32 => "I32"
      case TI64 => "I64"
      case TString => "STRING"
      case TBinary => "STRING" // thrift's idea of "string" is based on old broken c++ semantics.
      case StructType(_, _) => "STRUCT"
      case EnumType(_, _) => "ENUM"
      case MapType(_, _, _) => "MAP"
      case SetType(_, _) => "SET"
      case ListType(_, _) => "LIST"
      case x => throw new InternalError("constType#" + t)
    }
    v(getCode(t))
  }