Merge pull request #2284 from xhh/java-file-date-model-name-fix

[Java] Fix invalid imports when model name prefix/suffix is present
This commit is contained in:
wing328 2016-03-01 18:09:32 +08:00
commit ea3232cb08

View File

@ -83,6 +83,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
); );
instantiationTypes.put("array", "ArrayList"); instantiationTypes.put("array", "ArrayList");
instantiationTypes.put("map", "HashMap"); instantiationTypes.put("map", "HashMap");
typeMapping.put("date", "Date");
typeMapping.put("file", "File");
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
@ -488,7 +490,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
if (typeMapping.containsKey(swaggerType)) { if (typeMapping.containsKey(swaggerType)) {
type = typeMapping.get(swaggerType); type = typeMapping.get(swaggerType);
if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 || if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 ||
type.equals("Map") || type.equals("List")) { type.equals("Map") || type.equals("List") ||
type.equals("File") || type.equals("Date")) {
return type; return type;
} }
} else { } else {