Skip to content

Commit

Permalink
Replace with the helper function: getTypeDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
ackintosh committed Mar 31, 2018
1 parent 353c51f commit faa9016
Show file tree
Hide file tree
Showing 35 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ public String toInstantiationType(Schema p) {
public String getTypeDeclaration(Schema p) {
if (p instanceof ArraySchema) {
return getArrayTypeDeclaration((ArraySchema) p);
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
// Should we also support maps of maps?
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public String getTypeDeclaration(Schema p) {
Schema inner = ap.getItems();
return "[]" + getTypeDeclaration(inner);
}
else if (p instanceof MapSchema) {
else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public String getSchemaType(Schema p) {
public String getTypeDeclaration(Schema p) {
if (p instanceof ArraySchema) {
return getArrayTypeDeclaration((ArraySchema) p);
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getTypeDeclaration(inner) + "[]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "{ [key: string]: " + getTypeDeclaration(inner) + "; }";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public String toDefaultValue(Schema p) {
return "null";
} else if (p instanceof IntegerSchema) {
return "null";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return "Map[String, " + inner + "].empty ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public String getTypeDeclaration(Schema p) {
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
}
else if (p instanceof MapSchema) {
else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[String, " + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public String getTypeDeclaration(Schema p) {
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">";
}
if (p instanceof MapSchema) {
if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "<std::string, " + getTypeDeclaration(inner) + ">";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">*";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "<QString, " + getTypeDeclaration(inner) + ">*";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public String getTypeDeclaration(Schema p) {
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">";
}
if (p instanceof MapSchema) {
if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "<utility::string_t, " + getTypeDeclaration(inner) + ">";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public String getTypeDeclaration(Schema p) {
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">";
}
if (p instanceof MapSchema) {
if (isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties();
return getSchemaType(p) + "<std::string, " + getTypeDeclaration(inner) + ">";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public String toApiFilename(String name) {

@Override
public String toDefaultValue(Schema p) {
if (p instanceof MapSchema) {
if (isMapSchema(p)) {
return "{}";
} else if (p instanceof ArraySchema) {
return "[]";
Expand All @@ -290,7 +290,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "%{optional(String.t) => " + getTypeDeclaration(inner) + "}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "(Map.Map String " + getTypeDeclaration(inner) + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "Map.Map String " + getTypeDeclaration(inner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "{String: " + getTypeDeclaration(inner) + "}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public String getTypeDeclaration(Schema p) {
}
return getSchemaType(p) + "<" + innerTypeDeclaration + ">*";
}
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getTypeDeclaration(inner) + "[]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public String getTypeDeclaration(Schema p) {
return getTypeDeclaration(inner);
}

if (p instanceof MapSchema) {
if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getTypeDeclaration(inner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getTypeDeclaration(inner) + "[]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
// TODO not sure if the following map/hash declaration is correct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getTypeDeclaration(inner);
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getTypeDeclaration(inner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public String getTypeDeclaration(Schema schema) {
if (schema instanceof ArraySchema) {
Schema inner = ((ArraySchema) schema).getItems();
return String.format("%s[%s]", getSchemaType(schema), getTypeDeclaration(inner));
} else if (schema instanceof MapSchema) {
} else if (isMapSchema(schema)) {
Schema inner = (Schema) schema.getAdditionalProperties();
return String.format("%s[String, %s]", getSchemaType(schema), getTypeDeclaration(inner));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "[String:" + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public String getTypeDeclaration(Schema prop) {
ArraySchema ap = (ArraySchema) prop;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (prop instanceof MapSchema) {
} else if (isMapSchema(prop)) {
MapSchema mp = (MapSchema) prop;
Schema inner = (Schema) mp.getAdditionalProperties();
return "[String:" + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public String getTypeDeclaration(Schema p) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
MapSchema mp = (MapSchema) p;
Schema inner = (Schema) mp.getAdditionalProperties();
return "[String:" + getTypeDeclaration(inner) + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public String getTypeDeclaration(Schema p) {
if (p instanceof ArraySchema) {
inner = ((ArraySchema) p).getItems();
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(inner) + ">";
} else if (p instanceof MapSchema) {
} else if (isMapSchema(p)) {
inner = (Schema) p.getAdditionalProperties();
return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }";
} else if (p instanceof FileSchema) {
Expand Down

0 comments on commit faa9016

Please # to comment.