From da5b28d212bd2baad3b32c2c2e0085920c438d72 Mon Sep 17 00:00:00 2001 From: bellingard Date: Mon, 1 Nov 2010 12:07:38 +0000 Subject: [SONAR-1875] Improve CodeReaderFilter with channel capabilities http://jira.codehaus.org/browse/SONAR-1875 --- .../org/sonar/channel/CodeReaderConfiguration.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'sonar-channel/src') diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java index 7a50d4be6e2..4976a0ea6ba 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java @@ -19,6 +19,10 @@ */ package org.sonar.channel; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + /** * Configuration parameters used by a CodeReader to handle some specificities. */ @@ -32,7 +36,7 @@ public class CodeReaderConfiguration { private int tabWidth = DEFAULT_TAB_WIDTH; - private CodeReaderFilter[] codeReaderFilters = new CodeReaderFilter[0]; + private List> codeReaderFilters = new ArrayList>(); /** * @return the bufferCapacity @@ -69,7 +73,7 @@ public class CodeReaderConfiguration { */ @SuppressWarnings("rawtypes") public CodeReaderFilter[] getCodeReaderFilters() { - return codeReaderFilters; + return codeReaderFilters.toArray(new CodeReaderFilter[codeReaderFilters.size()]); } /** @@ -77,7 +81,17 @@ public class CodeReaderConfiguration { * the codeReaderFilters to set */ public void setCodeReaderFilters(CodeReaderFilter... codeReaderFilters) { - this.codeReaderFilters = codeReaderFilters; + this.codeReaderFilters = new ArrayList>(Arrays.asList(codeReaderFilters)); + } + + /** + * Adds a code reader filter + * + * @param codeReaderFilter + * the codeReaderFilter to add + */ + public void addCodeReaderFilters(CodeReaderFilter codeReaderFilter) { + this.codeReaderFilters.add(codeReaderFilter); } public CodeReaderConfiguration cloneWithoutCodeReaderFilters() { -- cgit v1.2.3