From 6c3cabc19361b698b69b5f54f1c6bc0147f9f92e Mon Sep 17 00:00:00 2001 From: Freddy Mallet Date: Tue, 24 May 2011 22:18:29 +0200 Subject: [PATCH] The Markdown class uses the new ChannelDispatch Builder --- .../java/org/sonar/markdown/Markdown.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java b/sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java index 9e7522cd692..f727d748e60 100644 --- a/sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java +++ b/sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java @@ -19,13 +19,9 @@ */ package org.sonar.markdown; -import org.sonar.channel.Channel; import org.sonar.channel.ChannelDispatcher; import org.sonar.channel.CodeReader; -import java.util.Arrays; -import java.util.List; - /** * Entry point of the Markdown library */ @@ -34,15 +30,15 @@ public final class Markdown { private ChannelDispatcher dispatcher; private Markdown() { - List markdownChannels = Arrays.asList( - new HtmlUrlChannel(), - new HtmlEndOfLineChannel(), - new HtmlEmphasisChannel(), - new HtmlListChannel(), - new HtmlCodeChannel(), - new IdentifierAndNumberChannel(), - new BlackholeChannel()); - dispatcher = new ChannelDispatcher(markdownChannels); + dispatcher = ChannelDispatcher.builder() + .addChannel(new HtmlUrlChannel()) + .addChannel(new HtmlEndOfLineChannel()) + .addChannel(new HtmlEmphasisChannel()) + .addChannel(new HtmlListChannel()) + .addChannel(new HtmlCodeChannel()) + .addChannel(new IdentifierAndNumberChannel()) + .addChannel(new BlackholeChannel()) + .build(); } private String convert(String input) { @@ -51,7 +47,7 @@ public final class Markdown { MarkdownOutput output = new MarkdownOutput(); dispatcher.consume(reader, output); return output.toString(); - + } finally { reader.close(); } -- 2.39.5