aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-02-22 00:53:28 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-02-22 00:53:28 +0100
commit53dd941df44c4529ae6fb58f64c1fa5c62b1f7db (patch)
treec4d8938635921e0cbe21c198ff71d78110d48119 /sonar-plugin-api
parent2354d349fbb29c29502f9bd7a3bf4da4f8e94ad3 (diff)
downloadsonarqube-53dd941df44c4529ae6fb58f64c1fa5c62b1f7db.tar.gz
sonarqube-53dd941df44c4529ae6fb58f64c1fa5c62b1f7db.zip
Use List instead of Collection into ResourceTypes and ResourceTypeTree
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java12
2 files changed, 11 insertions, 10 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
index 7fbdac2e7e2..38b26c11a72 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
@@ -31,7 +31,6 @@ import org.sonar.api.batch.InstantiationStrategy;
import javax.annotation.concurrent.Immutable;
import java.util.Arrays;
import java.util.List;
-import java.util.Set;
/**
* @since 2.14
@@ -42,18 +41,18 @@ import java.util.Set;
public final class ResourceTypeTree implements BatchExtension, ServerExtension {
private List<ResourceType> types;
- private SetMultimap<String, String> relations;
+ private ListMultimap<String, String> relations;
private ResourceTypeTree(Builder builder) {
this.types = ImmutableList.copyOf(builder.types);
- this.relations = ImmutableSetMultimap.copyOf(builder.relations);
+ this.relations = ImmutableListMultimap.copyOf(builder.relations);
}
public List<ResourceType> getTypes() {
return types;
}
- public Set<String> getChildren(String qualifier) {
+ public List<String> getChildren(String qualifier) {
return relations.get(qualifier);
}
@@ -71,7 +70,7 @@ public final class ResourceTypeTree implements BatchExtension, ServerExtension {
public static class Builder {
private List<ResourceType> types = Lists.newArrayList();
- private SetMultimap<String, String> relations = HashMultimap.create();
+ private ListMultimap<String, String> relations = ArrayListMultimap.create();
private Builder() {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
index 526ba1909a0..4ae3c823bb9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
@@ -25,12 +25,14 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.sonar.api.BatchComponent;
import org.sonar.api.ServerComponent;
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
/**
@@ -52,7 +54,7 @@ public final class ResourceTypes implements BatchComponent, ServerComponent {
Preconditions.checkNotNull(trees);
Map<String, ResourceTypeTree> treeMap = Maps.newHashMap();
- Map<String, ResourceType> typeMap = Maps.newHashMap();
+ Map<String, ResourceType> typeMap = Maps.newLinkedHashMap();
for (ResourceTypeTree tree : trees) {
for (ResourceType type : tree.getTypes()) {
@@ -80,7 +82,7 @@ public final class ResourceTypes implements BatchComponent, ServerComponent {
return Collections2.filter(typeByQualifier.values(), predicate);
}
- public Collection<String> getChildrenQualifiers(String qualifier) {
+ public List<String> getChildrenQualifiers(String qualifier) {
ResourceTypeTree tree = getTree(qualifier);
if (tree != null) {
return tree.getChildren(qualifier);
@@ -88,15 +90,15 @@ public final class ResourceTypes implements BatchComponent, ServerComponent {
return Collections.emptyList();
}
- public Collection<ResourceType> getChildren(String qualifier) {
- return Collections2.transform(getChildrenQualifiers(qualifier), new Function<String, ResourceType>() {
+ public List<ResourceType> getChildren(String qualifier) {
+ return Lists.transform(getChildrenQualifiers(qualifier), new Function<String, ResourceType>() {
public ResourceType apply(String s) {
return typeByQualifier.get(s);
}
});
}
- public Collection<String> getLeavesQualifiers(String qualifier) {
+ public List<String> getLeavesQualifiers(String qualifier) {
ResourceTypeTree tree = getTree(qualifier);
if (tree != null) {
return tree.getLeaves();