fixed default values

This commit is contained in:
Tony Tam 2012-09-25 22:31:52 -07:00
parent 93d81b84dc
commit 667b1cf7a5

View File

@ -106,15 +106,15 @@ abstract class CodegenConfig {
} }
} }
def toDefaultValue(datatype: String, defaultValue: String): Option[String] = { def toDefaultValue(datatype: String, v: String): Option[String] = {
if (defaultValue != "" && defaultValue != null) { if (v != "" && v != null) {
toDeclaredType(datatype) match { datatype match {
case "int" => Some(defaultValue) case "int" => Some(v)
case "long" => Some(defaultValue) case "long" => Some(v)
case "double" => Some(defaultValue) case "double" => Some(v)
case x if x == "string" || x == "String" => { case x if x == "string" || x == "String" => {
defaultValue match { v match {
case e: String => Some("\"" + defaultValue + "\"") case e: String => Some("\"" + v + "\"")
case _ => None case _ => None
} }
} }