summaryrefslogtreecommitdiffstats
path: root/sonar-markdown
diff options
context:
space:
mode:
authorFreddy Mallet <freddy.mallet@gmail.com>2011-05-24 22:18:29 +0200
committerFreddy Mallet <freddy.mallet@gmail.com>2011-05-24 22:18:29 +0200
commit6c3cabc19361b698b69b5f54f1c6bc0147f9f92e (patch)
treef21936836791473e91cdebc2634a25d9bbea48c0 /sonar-markdown
parentaa5ecf8f621183473b73df6b6cbadb3417d91ce2 (diff)
downloadsonarqube-6c3cabc19361b698b69b5f54f1c6bc0147f9f92e.tar.gz
sonarqube-6c3cabc19361b698b69b5f54f1c6bc0147f9f92e.zip
The Markdown class uses the new ChannelDispatch Builder
Diffstat (limited to 'sonar-markdown')
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java24
1 files 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<MarkdownOutput> dispatcher;
private Markdown() {
- List<Channel> markdownChannels = Arrays.<Channel>asList(
- new HtmlUrlChannel(),
- new HtmlEndOfLineChannel(),
- new HtmlEmphasisChannel(),
- new HtmlListChannel(),
- new HtmlCodeChannel(),
- new IdentifierAndNumberChannel(),
- new BlackholeChannel());
- dispatcher = new ChannelDispatcher<MarkdownOutput>(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();
}