Skip to content

Commit

Permalink
Refine printJson to take modules in account when sorting elements
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Jun 3, 2024
1 parent 1f2a7c1 commit 97c56cd
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,13 @@ public void printJson(JsonWriter writer) throws IOException {
if (!ignoredResources.isEmpty()) {
writer.append(',').newline();
writer.quote("excludes").append(':');
JsonPrinter.printCollection(writer, ignoredResources.keySet(), ConditionalElement.comparator(), ResourceConfiguration::conditionalIgnoredElementJson);
JsonPrinter.printCollection(writer, ignoredResources.keySet(), ConditionalElement.comparator(), ResourceConfiguration::conditionalRegexElementJson);
}
writer.unindent();
writer.append('}').append(',').newline();
writer.quote("globs").append(':');
JsonPrinter.printCollection(writer, addedGlobs, ConditionalElement.comparator(Comparator.comparing(ResourceEntry::pattern)), ResourceConfiguration::conditionalGlobElementJson);
JsonPrinter.printCollection(writer, addedGlobs, ConditionalElement.comparator(Comparator.comparing(ResourceEntry::pattern).thenComparing(ResourceEntry::module)),
ResourceConfiguration::conditionalGlobElementJson);
writer.append(',').newline();
writer.quote("bundles").append(':');
JsonPrinter.printCollection(writer, bundles.keySet(), ConditionalElement.comparator(), (p, w) -> printResourceBundle(bundles.get(p), w));
Expand Down Expand Up @@ -373,13 +374,6 @@ private static void conditionalRegexElementJson(ConditionalElement<String> p, Js
w.unindent().newline().append('}');
}

private static void conditionalIgnoredElementJson(ConditionalElement<String> p, JsonWriter w) throws IOException {
w.append('{').indent().newline();
ConfigurationConditionPrintable.printConditionAttribute(p.condition(), w);
w.quote("pattern").append(':').quote(p.element());
w.unindent().newline().append('}');
}

public interface Predicate {
boolean testIncludedResource(ConditionalElement<String> condition);

Expand Down

0 comments on commit 97c56cd

Please sign in to comment.