diff options
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java | 7 | ||||
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java | 7 |
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); + } } |