Merge pull request #2114 from delenius/static-factories

Use static model factory methods
This commit is contained in:
wing328
2016-02-15 10:13:09 +08:00
15 changed files with 118 additions and 90 deletions

View File

@@ -339,10 +339,10 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
@Override
public String toDefaultValueWithParam(String name, Property p) {
String type = normalizeType(getTypeDeclaration(p));
if (p instanceof RefProperty) {
return ".constructFromObject(data['" + name + "']);";
return " = " + type + ".constructFromObject(data['" + name + "']);";
} else {
String type = normalizeType(getTypeDeclaration(p));
return " = ApiClient.convertToType(data['" + name + "'], " + type + ");";
}
}