- Changed enum class name format
- CodegenProperty parent and parentClass replaced by Booolen flag isInherited
This commit is contained in:
Jakub Malek
2016-06-02 08:14:49 +02:00
committed by Jakub Malek
parent dbc6c2f163
commit 1cfb3d1c9c
6 changed files with 11 additions and 18 deletions

View File

@@ -44,8 +44,7 @@ public class CodegenProperty implements Cloneable {
public CodegenProperty items;
public Map<String, Object> vendorExtensions;
public Boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
public String parent;
public String parentClass;
public Boolean isInherited;
@Override
public String toString() {
@@ -108,8 +107,7 @@ public class CodegenProperty implements Cloneable {
result = prime * result + ((isDateTime == null) ? 0 : isDateTime.hashCode());
result = prime * result + ((isMapContainer == null) ? 0 : isMapContainer.hashCode());
result = prime * result + ((isListContainer == null) ? 0 : isListContainer.hashCode());
result = prime * result + Objects.hashCode(parent);
result = prime * result + Objects.hashCode(parentClass);
result = prime * result + Objects.hashCode(isInherited);
return result;
}
@@ -261,10 +259,7 @@ public class CodegenProperty implements Cloneable {
if (this.isMapContainer != other.isMapContainer && (this.isMapContainer == null || !this.isMapContainer.equals(other.isMapContainer))) {
return false;
}
if (!Objects.equals(this.parent, other.parent)) {
return false;
}
if (!Objects.equals(this.parentClass, other.parentClass)) {
if (!Objects.equals(this.isInherited, other.isInherited)) {
return false;
}
return true;

View File

@@ -264,9 +264,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
if (duplicatedByParent != null) {
log.info(String.format("Property: '%s' in '%s' model is inherited from '%s'" ,
property.name, child.classname, parent.classname));
duplicatedByParent.parent = parent.name;
duplicatedByParent.parentClass = parent.classname;
duplicatedByParent.isInherited = true;
final CodegenProperty parentVar = duplicatedByParent.clone();
parentVar.hasMore = false;
child.parentVars.add(parentVar);
@@ -354,7 +352,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
@Override
public String toEnumName(final CodegenProperty property) {
return sanitizeName(camelize(property.name));
return sanitizeName(camelize(property.name)) + "Enum";
}
@Override