Skip to content

Commit

Permalink
use setters in constructors, the underlying map isn't updated otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
rienafairefr committed Feb 16, 2019
1 parent 11eda29 commit 01284e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class ModelBundle extends BaseBundle{
String importPath;

public ModelBundle(Map<String, Object> model) {
this.model = (CodegenModel) model.get("model");
this.importPath = (String) model.get("importPath");
setModel((CodegenModel) model.get("model"));
setImportPath((String) model.get("importPath"));
}

public ModelBundle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ public class ModelsBundle extends BaseBundle {
private String classname;
private String modelPackage;

@SuppressWarnings("unchecked")
public ModelsBundle (Map<String, Object> value) {
this._package = (String) value.get("package");
setPackage((String) value.get("package"));
List<Map<String, Object>> models = (List<Map<String, Object>>) value.get("models");
List<ModelBundle> modelBundles = new ArrayList<>();
for (Map<String, Object> model : models) {
this.models.add(new ModelBundle(model));
modelBundles.add(new ModelBundle(model));
}
this.imports = (List<Map<String, String>>) value.get("imports");
this.classname = (String) value.get("classname");
this.modelPackage = (String) value.get("modelPackage");
setModels(modelBundles);
setImports((List<Map<String, String>>) value.get("imports"));
setClassname((String) value.get("classname"));
setModelPackage((String) value.get("modelPackage"));
}

public ModelsBundle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,13 @@ public void setExternalDocs(ExternalDocumentation externalDocs) {
}


public List<Map<String, String>> getPathSet() {
return pathSet;
}

public void setPathSet(List<Map<String, String>> pathSet) {
this.pathSet = pathSet;
put("pathSet", pathSet);
}


public boolean getHasAuthMethods() {
return hasAuthMethods;
}

public void setHasAuthMethods(boolean hasAuthMethods) {
this.hasAuthMethods = hasAuthMethods;
put("hasAuthMethods", hasAuthMethods);
}


Expand All @@ -204,6 +195,7 @@ public boolean getHasOAuthMethods() {

public void setHasOAuthMethods(boolean hasOAuthMethods) {
this.hasOAuthMethods = hasOAuthMethods;
put("hasOAuthMethods", hasOAuthMethods);
}


Expand All @@ -213,6 +205,7 @@ public List<CodegenSecurity> getOauthMethods() {

public void setOauthMethods(List<CodegenSecurity> oauthMethods) {
this.oauthMethods = oauthMethods;
put("oauthMethods", oauthMethods);
}


Expand All @@ -222,5 +215,6 @@ public boolean getHasBearerMethods() {

public void setHasBearerMethods(boolean hasBearerMethods) {
this.hasBearerMethods = hasBearerMethods;
put("hasBearerMethods", hasBearerMethods);
}
}

0 comments on commit 01284e6

Please sign in to comment.