Add methods to manipulate the configured parsers
This makes it possible to add new parsers through the script console or on Jenkins start-up.
@@ -153,23 +153,32 @@ public final class WarningsDescriptor extends PluginDescriptor implements Staple
}
/**
- * Replaces the list of given groovy Parsers
- *
- * @return the Boolean value after replacing the given groovy Parsers.
+ * Adds the given Groovy parser to the configured Groovy parsers
*/
+ public void addGroovyParser(GroovyParser parser) {
+ groovyParsers.add(parser);
+ save();
+ }
- public boolean replaceGroovyParsers(List<GroovyParser> groovyParserList) {
- groovyParsers.replaceBy(groovyParserList);
-
+ /**
+ * Adds the given list of Groovy parsers to the configured Groovy parsers
+ */
+ public void addGroovyParsers(List<GroovyParser> parsers) {
+ groovyParsers.addAll(parsers);
save();
+ }
- return true;
+ /**
+ * Replaces the configured Groovy parsers with the given list.
+ */
+ public void replaceGroovyParsers(List<GroovyParser> parsers) {
+ groovyParsers.replaceBy(parsers);
+ save();
}
@Override
public boolean configure(final StaplerRequest req, final JSONObject formData) {
replaceGroovyParsers(req.bindJSONToList(GroovyParser.class, formData.get("parsers")));
-
return true;
}
