aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-channel
diff options
context:
space:
mode:
authorbellingard <bellingard@gmail.com>2010-11-01 12:07:38 +0000
committerbellingard <bellingard@gmail.com>2010-11-01 12:07:38 +0000
commitda5b28d212bd2baad3b32c2c2e0085920c438d72 (patch)
treef9a0942bdb246b545ad3c7d7a5bc0f34055116b7 /sonar-channel
parent7e6ae83107c50fae8f11aa41304adaecf7d0d4fc (diff)
downloadsonarqube-da5b28d212bd2baad3b32c2c2e0085920c438d72.tar.gz
sonarqube-da5b28d212bd2baad3b32c2c2e0085920c438d72.zip
[SONAR-1875] Improve CodeReaderFilter with channel capabilities
http://jira.codehaus.org/browse/SONAR-1875
Diffstat (limited to 'sonar-channel')
-rw-r--r--sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java20
1 files changed, 17 insertions, 3 deletions
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<CodeReaderFilter<?>> codeReaderFilters = new ArrayList<CodeReaderFilter<?>>();
/**
* @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<CodeReaderFilter<?>>(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() {