[csharp] Fix interfacePrefix sensitivity + default (#4561)

After merging the fix with another C# change, noticed case sensitivity
issue for the true/false checks. Also noticed my original implementation
wasn't setting the default I- prefix as intended. This commit resolves
those three issues.
This commit is contained in:
Jim Schubert 2017-01-15 11:12:03 -06:00 committed by wing328
parent 2d8715f42c
commit 23c5376ed6

View File

@ -259,15 +259,16 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) {
String useInterfacePrefix = additionalProperties.get(CodegenConstants.INTERFACE_PREFIX).toString();
if("false".equals(useInterfacePrefix)) {
if("false".equals(useInterfacePrefix.toLowerCase())) {
setInterfacePrefix("");
} else if(!"true".equals(useInterfacePrefix)) {
} else if(!"true".equals(useInterfacePrefix.toLowerCase())) {
// NOTE: if user passes "true" explicitly, we use the default I- prefix. The other supported case here is a custom prefix.
setInterfacePrefix(sanitizeName(useInterfacePrefix));
}
additionalProperties.put(CodegenConstants.INTERFACE_PREFIX, interfacePrefix);
}
// This either updates additionalProperties with the above fixes, or sets the default if the option was not specified.
additionalProperties.put(CodegenConstants.INTERFACE_PREFIX, interfacePrefix);
}
@Override