Add title field to CodegenProperty (#4590)

Earlier CodegenProperty did not have title field.
'title' information of the property was lost while converting from Property to CodegenProperty.
This change fixes it.
This commit is contained in:
Sreenidhi Sreesha 2017-01-17 23:27:56 -08:00 committed by wing328
parent 0a559f0dd2
commit da01b2e71a
2 changed files with 8 additions and 2 deletions

View File

@ -7,8 +7,9 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
public class CodegenProperty implements Cloneable { public class CodegenProperty implements Cloneable {
public String baseName, complexType, getter, setter, description, datatype, datatypeWithEnum, public String baseName, complexType, getter, setter, description, datatype,
dataFormat, name, min, max, defaultValue, defaultValueWithParam, baseType, containerType; datatypeWithEnum, dataFormat, name, min, max, defaultValue, defaultValueWithParam,
baseType, containerType, title;
public String unescapedDescription; public String unescapedDescription;
@ -77,6 +78,7 @@ public class CodegenProperty implements Cloneable {
result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
result = prime * result + ((defaultValueWithParam == null) ? 0 : defaultValueWithParam.hashCode()); result = prime * result + ((defaultValueWithParam == null) ? 0 : defaultValueWithParam.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + ((example == null) ? 0 : example.hashCode()); result = prime * result + ((example == null) ? 0 : example.hashCode());
result = prime * result + (exclusiveMaximum ? 13:31); result = prime * result + (exclusiveMaximum ? 13:31);
result = prime * result + (exclusiveMinimum ? 13:31); result = prime * result + (exclusiveMinimum ? 13:31);
@ -149,6 +151,9 @@ public class CodegenProperty implements Cloneable {
if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) { if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
return false; return false;
} }
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
return false;
}
if ((this.datatype == null) ? (other.datatype != null) : !this.datatype.equals(other.datatype)) { if ((this.datatype == null) ? (other.datatype != null) : !this.datatype.equals(other.datatype)) {
return false; return false;
} }

View File

@ -1463,6 +1463,7 @@ public class DefaultCodegen {
property.nameInCamelCase = camelize(property.name, false); property.nameInCamelCase = camelize(property.name, false);
property.description = escapeText(p.getDescription()); property.description = escapeText(p.getDescription());
property.unescapedDescription = p.getDescription(); property.unescapedDescription = p.getDescription();
property.title = p.getTitle();
property.getter = "get" + getterAndSetterCapitalize(name); property.getter = "get" + getterAndSetterCapitalize(name);
property.setter = "set" + getterAndSetterCapitalize(name); property.setter = "set" + getterAndSetterCapitalize(name);
property.example = toExampleValue(p); property.example = toExampleValue(p);