Android client: better local variable naming

and fix the importing of Long and Byte
This commit is contained in:
xhh
2016-02-29 18:27:23 +08:00
parent 9b229de79f
commit 75c2cc9029
6 changed files with 413 additions and 270 deletions

View File

@@ -45,9 +45,9 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
setReservedWordsLowerCase(
Arrays.asList(
// local variable names used in API methods (endpoints)
"postBody", "path", "queryParams", "headerParams", "formParams",
"contentTypes", "contentType", "response", "builder", "httpEntity",
"authNames", "basePath", "apiInvoker",
"localVarPostBody", "localVarPath", "localVarQueryParams", "localVarHeaderParams",
"localVarFormParams", "localVarContentTypes", "localVarContentType",
"response", "builder", "authNames", "basePath", "apiInvoker",
// android reserved words
"abstract", "continue", "for", "new", "switch", "assert",
@@ -68,6 +68,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
"Integer",
"Long",
"Float",
"byte[]",
"Object")
);
instantiationTypes.put("array", "ArrayList");
@@ -141,8 +142,9 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
String type = null;
if (typeMapping.containsKey(swaggerType)) {
type = typeMapping.get(swaggerType);
if (languageSpecificPrimitives.contains(type)) {
return toModelName(type);
if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 ||
type.equals("Map") || type.equals("List")) {
return type;
}
} else {
type = swaggerType;