Skip to content

Commit

Permalink
modified configspec to include desc as a field
Browse files Browse the repository at this point in the history
  • Loading branch information
rhit-shirakrk committed May 14, 2024
1 parent db75d01 commit 19a3776
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/datasource/configspec/ConfigSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ public static final class Section {
private final String checkName;
private final String entityType;
private final List<Setting> settings;
private final String desc;

public Section(String title, String checkName, String entityTypeOverride, List<Setting> settings) {
public Section(String title, String checkName, String desc, String entityTypeOverride, List<Setting> settings) {
if (title == null) {throw new NullPointerException("title");}
this.title = title;
this.checkName = checkName;
this.desc = desc;
this.entityType = (checkName != null) ? ((entityTypeOverride != null) ? entityTypeOverride : DEFAULT_ENTITY_TYPE) : null;
this.settings = (settings != null) ? new ArrayList<Setting>(settings) : null;
}
Expand All @@ -58,6 +60,11 @@ public String getCheckName() {
return this.checkName;
}

public String getDescName() {
this.validateRepresentsCheck();
return this.desc;
}

public String getEntityType() {
this.validateRepresentsCheck();
return this.entityType;
Expand All @@ -79,6 +86,7 @@ public boolean equals(Object obj) {
Section other = (Section)obj;
return CmpUtil.areEqual(this.title, other.title)
&& CmpUtil.areEqual(this.checkName, other.checkName)
&& CmpUtil.areEqual(this.desc, other.desc)
&& CmpUtil.areEqual(this.entityType, other.entityType)
&& CmpUtil.areEqual(this.settings, other.settings);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private List<ConfigSpec.Section> readSections(JSONArray sectionsJson, Map<String
sections.add(new ConfigSpec.Section(
sectionJson.getString("title"),
getStringOrNull(sectionJson, "checkName"),
getStringOrNull(sectionJson, "desc"),
getStringOrNull(sectionJson, "entityTypeOverride"),
readSettings(sectionJson, selects)
));
Expand Down

0 comments on commit 19a3776

Please sign in to comment.