aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-07-28 10:14:43 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-07-28 10:14:51 +0200
commit5d4a6f543838403f26e9f18ee0ead44398ffec0f (patch)
tree5b45dd9d737a1a978f6975048d23283dbf59ad7b
parent831f128056cdd575e54d1635943833cebf898fb4 (diff)
downloadsonarqube-5d4a6f543838403f26e9f18ee0ead44398ffec0f.tar.gz
sonarqube-5d4a6f543838403f26e9f18ee0ead44398ffec0f.zip
Add convenient factory methods ResourceQuery#create(String resourceKey) and Rule#create(String repo, String key)
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java7
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java7
2 files changed, 14 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
index 29a3451d374..01cf4bb0952 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
@@ -426,4 +426,11 @@ public final class Rule {
return new Rule().setUniqueKey(repositoryKey, key).setName(name);
}
+ /**
+ * Create with all required fields
+ * @since 2.10
+ */
+ public static Rule create(String repositoryKey, String key) {
+ return new Rule().setUniqueKey(repositoryKey, key);
+ }
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java
index 608542513f4..eb5482b5c12 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java
@@ -294,4 +294,11 @@ public class ResourceQuery extends Query<Resource> {
return new ResourceQuery(resource.getId().toString())
.setMetrics(metricKeys);
}
+
+ /**
+ * @since 2.10
+ */
+ public static ResourceQuery create(String resourceKey) {
+ return new ResourceQuery(resourceKey);
+ }
}