#3285 ModelNamePre- and Suffixes should not be applied to Types.

This commit is contained in:
christian 2016-07-04 20:20:56 +02:00
parent 6d6cfbfd5d
commit ceffa84cdf
2 changed files with 12 additions and 1 deletions

View File

@ -1122,12 +1122,18 @@ public class DefaultCodegen {
} }
/** /**
* Output the proper model name (capitalized) * Output the proper model name (capitalized).
* In case the name belongs to the TypeSystem it won't be renamed.
* *
* @param name the name of the model * @param name the name of the model
* @return capitalized model name * @return capitalized model name
*/ */
public String toModelName(final String name) { public String toModelName(final String name) {
// Don't do any kind of renaming to language specific types
if(typeMapping.values().contains(name)) {
return name;
}
return initialCaps(modelNamePrefix + name + modelNameSuffix); return initialCaps(modelNamePrefix + name + modelNameSuffix);
} }

View File

@ -343,6 +343,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
@Override @Override
public String toModelName(final String name) { public String toModelName(final String name) {
// Don't do any kind of sanitizing to Java types (e.g. BigDecimal)
if(typeMapping.values().contains(name)) {
return name;
}
final String sanitizedName = sanitizeName(modelNamePrefix + name + modelNameSuffix); final String sanitizedName = sanitizeName(modelNamePrefix + name + modelNameSuffix);
// camelize the model name // camelize the model name