diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-07-05 10:23:20 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-07-05 10:23:20 +0200 |
commit | 94be3ff3dbb62e585b80c6c3cf68396ed2e7d2e4 (patch) | |
tree | ba54d0e0bf88ce5796c2ec7b405fb79ce809cc0a /sonar-ws-client/src/main/java/org | |
parent | 44398cd47f416547002ed4830a7cbea2ae6f4186 (diff) | |
download | sonarqube-94be3ff3dbb62e585b80c6c3cf68396ed2e7d2e4.tar.gz sonarqube-94be3ff3dbb62e585b80c6c3cf68396ed2e7d2e4.zip |
Fix quality flaws
Diffstat (limited to 'sonar-ws-client/src/main/java/org')
26 files changed, 377 insertions, 188 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java index 90aff336e9c..472b87152d9 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java @@ -94,7 +94,7 @@ public final class JdkUtils extends WSUtils { @Override public int getArraySize(Object array) { - return ((ArrayList) array).size(); + return array == null ? 0 : ((ArrayList) array).size(); } @Override diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java index 4671d89a9dc..de76f8a54bd 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java @@ -21,6 +21,8 @@ package org.sonar.wsclient.issue.internal; import org.sonar.wsclient.issue.BulkChange; +import javax.annotation.Nullable; + import java.util.ArrayList; import java.util.List; @@ -45,12 +47,12 @@ public class DefaultBulkChange implements BulkChange { return totalIssuesNotChanged; } - DefaultBulkChange setTotalIssuesChanged(int totalIssuesChanged) { + DefaultBulkChange setTotalIssuesChanged(@Nullable int totalIssuesChanged) { this.totalIssuesChanged = totalIssuesChanged; return this; } - DefaultBulkChange setTotalIssuesNotChanged(int totalIssuesNotChanged) { + DefaultBulkChange setTotalIssuesNotChanged(@Nullable int totalIssuesNotChanged) { this.totalIssuesNotChanged = totalIssuesNotChanged; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java index 37b5348fa88..d75a9326e14 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java @@ -19,15 +19,17 @@ */ package org.sonar.wsclient.issue.internal; +import org.sonar.wsclient.base.Paging; import org.sonar.wsclient.component.Component; import org.sonar.wsclient.issue.ActionPlan; import org.sonar.wsclient.issue.Issue; import org.sonar.wsclient.issue.Issues; -import org.sonar.wsclient.base.Paging; import org.sonar.wsclient.rule.Rule; import org.sonar.wsclient.user.User; import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.*; /** @@ -100,6 +102,7 @@ public class DefaultIssues implements Issues { return paging; } + @Nullable public Boolean maxResultsReached() { return maxResultsReached; } @@ -139,7 +142,7 @@ public class DefaultIssues implements Issues { return this; } - DefaultIssues setMaxResultsReached(Boolean maxResultsReached) { + DefaultIssues setMaxResultsReached(@Nullable Boolean maxResultsReached) { this.maxResultsReached = maxResultsReached; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java index 706267021d4..438857078ff 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java @@ -19,6 +19,7 @@ */ package org.sonar.wsclient.issue.internal; +import org.json.simple.JSONArray; import org.json.simple.JSONValue; import org.sonar.wsclient.base.Paging; import org.sonar.wsclient.component.Component; @@ -135,7 +136,10 @@ public class IssueJsonParser { Map issuesNotChanged = (Map) jsonRoot.get("issuesNotChanged"); result.setTotalIssuesNotChanged(JsonUtils.getInteger(issuesNotChanged, "total")); - result.setIssuesNotChanged(JsonUtils.getArray(issuesNotChanged, "issues")); + JSONArray issuesJson = JsonUtils.getArray(issuesNotChanged, "issues"); + if (issuesJson != null) { + result.setIssuesNotChanged(JsonUtils.getArray(issuesNotChanged, "issues")); + } return result; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Authentication.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Authentication.java index f5d87acc752..9c669f8fd29 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Authentication.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Authentication.java @@ -19,6 +19,8 @@ */ package org.sonar.wsclient.services; +import javax.annotation.Nullable; + public class Authentication extends Model { private boolean valid; @@ -26,7 +28,7 @@ public class Authentication extends Model { return valid; } - public Authentication setValid(boolean valid) { + public Authentication setValid(@Nullable boolean valid) { this.valid = valid; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java index 4cf2a1ed8ab..a844ec6eee7 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + public class Dependency extends Model { private String id; @@ -33,6 +36,7 @@ public class Dependency extends Model { private String toName; private String toQualifier; + @CheckForNull public String getId() { return id; } @@ -46,7 +50,7 @@ public class Dependency extends Model { return fromId; } - public Dependency setFromId(long fromId) { + public Dependency setFromId(@Nullable long fromId) { this.fromId = fromId; return this; } @@ -55,79 +59,87 @@ public class Dependency extends Model { return toId; } - public Dependency setToId(long toId) { + public Dependency setToId(@Nullable long toId) { this.toId = toId; return this; } + @CheckForNull public String getFromKey() { return fromKey; } - public Dependency setFromKey(String fromKey) { + public Dependency setFromKey(@Nullable String fromKey) { this.fromKey = fromKey; return this; } + @CheckForNull public String getToKey() { return toKey; } - public Dependency setToKey(String toKey) { + public Dependency setToKey(@Nullable String toKey) { this.toKey = toKey; return this; } + @CheckForNull public String getUsage() { return usage; } - public Dependency setUsage(String usage) { + public Dependency setUsage(@Nullable String usage) { this.usage = usage; return this; } + @CheckForNull public Integer getWeight() { return weight; } - public Dependency setWeight(Integer weight) { + public Dependency setWeight(@Nullable Integer weight) { this.weight = weight; return this; } + @CheckForNull public String getFromName() { return fromName; } - public Dependency setFromName(String fromName) { + public Dependency setFromName(@Nullable String fromName) { this.fromName = fromName; return this; } + @CheckForNull public String getFromQualifier() { return fromQualifier; } - public Dependency setFromQualifier(String fromQualifier) { + public Dependency setFromQualifier(@Nullable String fromQualifier) { this.fromQualifier = fromQualifier; return this; } + @CheckForNull public String getToName() { return toName; } - public Dependency setToName(String toName) { + public Dependency setToName(@Nullable String toName) { this.toName = toName; return this; } + @CheckForNull public String getToQualifier() { return toQualifier; } - public Dependency setToQualifier(String toQualifier) { + public Dependency setToQualifier(@Nullable String toQualifier) { this.toQualifier = toQualifier; return this; } @@ -153,9 +165,9 @@ public class Dependency extends Model { @Override public String toString() { return new StringBuilder() - .append(fromKey) - .append(" -> ") - .append(toKey) - .toString(); + .append(fromKey) + .append(" -> ") + .append(toKey) + .toString(); } } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java index 15f22c252b6..e9e8d7480cb 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.List; /** @@ -36,74 +39,75 @@ public class DependencyTree extends Model { private int weight; private List<DependencyTree> to; + @CheckForNull public String getDepId() { return depId; } - public DependencyTree setDepId(String depId) { + public DependencyTree setDepId(@Nullable String depId) { this.depId = depId; return this; } - + @CheckForNull public String getResourceId() { return resourceId; } - public DependencyTree setResourceId(String resourceId) { + public DependencyTree setResourceId(@Nullable String resourceId) { this.resourceId = resourceId; return this; } - + @CheckForNull public String getResourceKey() { return resourceKey; } - public DependencyTree setResourceKey(String resourceKey) { + public DependencyTree setResourceKey(@Nullable String resourceKey) { this.resourceKey = resourceKey; return this; } - + @CheckForNull public String getResourceName() { return resourceName; } - public DependencyTree setResourceName(String resourceName) { + public DependencyTree setResourceName(@Nullable String resourceName) { this.resourceName = resourceName; return this; } - + @CheckForNull public String getUsage() { return usage; } - public DependencyTree setUsage(String usage) { + public DependencyTree setUsage(@Nullable String usage) { this.usage = usage; return this; } - + @CheckForNull public String getResourceScope() { return resourceScope; } - public DependencyTree setResourceScope(String resourceScope) { + public DependencyTree setResourceScope(@Nullable String resourceScope) { this.resourceScope = resourceScope; return this; } - + @CheckForNull public String getResourceQualifier() { return resourceQualifier; } - public DependencyTree setResourceQualifier(String resourceQualifier) { + public DependencyTree setResourceQualifier(@Nullable String resourceQualifier) { this.resourceQualifier = resourceQualifier; return this; } - + @CheckForNull public String getResourceVersion() { return resourceVersion; } - public DependencyTree setResourceVersion(String resourceVersion) { + public DependencyTree setResourceVersion(@Nullable String resourceVersion) { this.resourceVersion = resourceVersion; return this; } @@ -112,7 +116,7 @@ public class DependencyTree extends Model { return weight; } - public DependencyTree setWeight(int weight) { + public DependencyTree setWeight(@Nullable int weight) { this.weight = weight; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Event.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Event.java index 946d38c87ad..6809bcf366b 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Event.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Event.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.Date; public class Event extends Model { @@ -31,65 +34,66 @@ public class Event extends Model { private Date date; private String data; + @CheckForNull public String getId() { return id; } - public Event setId(String id) { + public Event setId(@Nullable String id) { this.id = id; return this; } - + @CheckForNull public String getName() { return name; } - public Event setName(String name) { + public Event setName(@Nullable String name) { this.name = name; return this; } - + @CheckForNull public String getCategory() { return category; } - public Event setCategory(String category) { + public Event setCategory(@Nullable String category) { this.category = category; return this; } - + @CheckForNull public String getDescription() { return description; } - public Event setDescription(String description) { + public Event setDescription(@Nullable String description) { this.description = description; return this; } - + @CheckForNull public Date getDate() { return date; } - public Event setDate(Date date) { + public Event setDate(@Nullable Date date) { this.date = date; return this; } - + @CheckForNull public String getResourceKey() { return resourceKey; } - public Event setResourceKey(String resourceKey) { + public Event setResourceKey(@Nullable String resourceKey) { this.resourceKey = resourceKey; return this; } - + @CheckForNull public String getData() { return data; } - public Event setData(String data) { + public Event setData(@Nullable String data) { this.data = data; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Favourite.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Favourite.java index b83ab5db447..146f08fa52a 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Favourite.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Favourite.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + public class Favourite extends Model { private Integer id; @@ -28,56 +31,63 @@ public class Favourite extends Model { private String qualifier; private String language; + @CheckForNull public Integer getId() { return id; } - public Favourite setId(Integer id) { + public Favourite setId(@Nullable Integer id) { this.id = id; return this; } + @CheckForNull public String getKey() { return key; } - public Favourite setKey(String key) { + public Favourite setKey(@Nullable String key) { this.key = key; return this; } + @CheckForNull public String getName() { return name; } - public Favourite setName(String name) { + + public Favourite setName(@Nullable String name) { this.name = name; return this; } + @CheckForNull public String getScope() { return scope; } - public Favourite setScope(String scope) { + public Favourite setScope(@Nullable String scope) { this.scope = scope; return this; } + @CheckForNull public String getQualifier() { return qualifier; } - public Favourite setQualifier(String qualifier) { + public Favourite setQualifier(@Nullable String qualifier) { this.qualifier = qualifier; return this; } + @CheckForNull public String getLanguage() { return language; } - public Favourite setLanguage(String language) { + public Favourite setLanguage(@Nullable String language) { this.language = language; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasure.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasure.java index bb03cec4d62..b08f3e7d749 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasure.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasure.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.Date; /** @@ -39,83 +42,84 @@ public class ManualMeasure extends Model { public ManualMeasure() { } + @CheckForNull public long getId() { return id; } - public ManualMeasure setId(long id) { + public ManualMeasure setId(@Nullable long id) { this.id = id; return this; } - + @CheckForNull public String getMetricKey() { return metricKey; } - public ManualMeasure setMetricKey(String metricKey) { + public ManualMeasure setMetricKey(@Nullable String metricKey) { this.metricKey = metricKey; return this; } - + @CheckForNull public Double getValue() { return value; } - public ManualMeasure setValue(Double value) { + public ManualMeasure setValue(@Nullable Double value) { this.value = value; return this; } - + @CheckForNull public String getTextValue() { return textValue; } - public ManualMeasure setTextValue(String textValue) { + public ManualMeasure setTextValue(@Nullable String textValue) { this.textValue = textValue; return this; } - + @CheckForNull public Date getCreatedAt() { return createdAt; } - public ManualMeasure setCreatedAt(Date createdAt) { + public ManualMeasure setCreatedAt(@Nullable Date createdAt) { this.createdAt = createdAt; return this; } - + @CheckForNull public Date getUpdatedAt() { return updatedAt; } - public ManualMeasure setUpdatedAt(Date updatedAt) { + public ManualMeasure setUpdatedAt(@Nullable Date updatedAt) { this.updatedAt = updatedAt; return this; } - + @CheckForNull public String getUserLogin() { return userLogin; } - public ManualMeasure setUserLogin(String userLogin) { + public ManualMeasure setUserLogin(@Nullable String userLogin) { this.userLogin = userLogin; return this; } - + @CheckForNull public String getUsername() { return username; } - public ManualMeasure setUsername(String username) { + public ManualMeasure setUsername(@Nullable String username) { this.username = username; return this; } - + @CheckForNull public String getResourceKey() { return resourceKey; } - public ManualMeasure setResourceKey(String resourceKey) { + public ManualMeasure setResourceKey(@Nullable String resourceKey) { this.resourceKey = resourceKey; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java index 5ad02cbdae9..127df45c856 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.LinkedHashMap; import java.util.Map; @@ -47,28 +50,32 @@ public class Measure extends Model { private Double variation1, variation2, variation3, variation4, variation5; + @CheckForNull public String getMetricKey() { return metricKey; } - public Measure setMetricKey(String metricKey) { + public Measure setMetricKey(@Nullable String metricKey) { this.metricKey = metricKey; return this; } + @CheckForNull public String getMetricName() { return metricName; } - public Measure setMetricName(String metricName) { + public Measure setMetricName(@Nullable String metricName) { this.metricName = metricName; return this; } + @CheckForNull public Double getValue() { return value; } + @CheckForNull public Integer getIntValue() { if (value == null) { return null; @@ -76,35 +83,40 @@ public class Measure extends Model { return value.intValue(); } - public Measure setValue(Double value) { + public Measure setValue(@Nullable Double value) { this.value = value; return this; } + @CheckForNull public String getFormattedValue() { return formattedValue; } - public String getFormattedValue(String defaultValue) { + @CheckForNull + public String getFormattedValue(@Nullable String defaultValue) { if (formattedValue == null) { return defaultValue; } return formattedValue; } - public Measure setFormattedValue(String formattedValue) { + public Measure setFormattedValue(@Nullable String formattedValue) { this.formattedValue = formattedValue; return this; } + @CheckForNull public String getData() { return data; } + @CheckForNull public Map<String, String> getDataAsMap() { return getDataAsMap(","); } + @CheckForNull public Map<String, String> getDataAsMap(String separator) { if (data == null) { return null; @@ -118,43 +130,47 @@ public class Measure extends Model { return map; } - public Measure setData(String data) { + public Measure setData(@Nullable String data) { this.data = data; return this; } + @CheckForNull public Integer getTrend() { return trend; } - public Measure setTrend(Integer trend) { + public Measure setTrend(@Nullable Integer trend) { this.trend = trend; return this; } + @CheckForNull public Integer getVar() { return var; } - public Measure setVar(Integer var) { + public Measure setVar(@Nullable Integer var) { this.var = var; return this; } + @CheckForNull public String getRuleKey() { return ruleKey; } - public Measure setRuleKey(String ruleKey) { + public Measure setRuleKey(@Nullable String ruleKey) { this.ruleKey = ruleKey; return this; } + @CheckForNull public String getRuleName() { return ruleName; } - public Measure setRuleName(String ruleName) { + public Measure setRuleName(@Nullable String ruleName) { this.ruleName = ruleName; return this; } @@ -163,6 +179,7 @@ public class Measure extends Model { * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 */ @Deprecated + @CheckForNull public String getRuleCategory() { return ruleCategory; } @@ -171,7 +188,7 @@ public class Measure extends Model { * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 */ @Deprecated - public Measure setRuleCategory(String ruleCategory) { + public Measure setRuleCategory(@Nullable String ruleCategory) { this.ruleCategory = ruleCategory; return this; } @@ -179,7 +196,7 @@ public class Measure extends Model { /** * @since 2.5 */ - public Measure setRuleSeverity(String ruleSeverity) { + public Measure setRuleSeverity(@Nullable String ruleSeverity) { this.ruleSeverity = ruleSeverity; return this; } @@ -187,6 +204,7 @@ public class Measure extends Model { /** * @since 2.5 */ + @CheckForNull public String getRuleSeverity() { return ruleSeverity; } @@ -195,6 +213,7 @@ public class Measure extends Model { * @deprecated since 2.5 use {@link #getRuleSeverity()} instead. See http://jira.codehaus.org/browse/SONAR-1829 */ @Deprecated + @CheckForNull public String getRulePriority() { return ruleSeverity; } @@ -203,25 +222,27 @@ public class Measure extends Model { * @deprecated since 2.5 use {@link #setRuleSeverity(String)} instead. See http://jira.codehaus.org/browse/SONAR-1829 */ @Deprecated - public Measure setRulePriority(String rulePriority) { + public Measure setRulePriority(@Nullable String rulePriority) { this.ruleSeverity = rulePriority; return this; } + @CheckForNull public String getCharacteristicKey() { return characteristicKey; } + @CheckForNull public String getCharacteristicName() { return characteristicName; } - public Measure setCharacteristicKey(String s) { + public Measure setCharacteristicKey(@Nullable String s) { this.characteristicKey = s; return this; } - public Measure setCharacteristicName(String s) { + public Measure setCharacteristicName(@Nullable String s) { this.characteristicName = s; return this; } @@ -230,6 +251,7 @@ public class Measure extends Model { * Variation value on period 1. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. * @since 2.5 */ + @CheckForNull public Double getVariation1() { return variation1; } @@ -237,7 +259,7 @@ public class Measure extends Model { /** * @since 2.5 */ - public Measure setVariation1(Double variation1) { + public Measure setVariation1(@Nullable Double variation1) { this.variation1 = variation1; return this; } @@ -246,6 +268,7 @@ public class Measure extends Model { * Variation value on period 2. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. * @since 2.5 */ + @CheckForNull public Double getVariation2() { return variation2; } @@ -253,7 +276,7 @@ public class Measure extends Model { /** * @since 2.5 */ - public Measure setVariation2(Double variation2) { + public Measure setVariation2(@Nullable Double variation2) { this.variation2 = variation2; return this; } @@ -262,6 +285,7 @@ public class Measure extends Model { * Variation value on period 3. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. * @since 2.5 */ + @CheckForNull public Double getVariation3() { return variation3; } @@ -269,7 +293,7 @@ public class Measure extends Model { /** * @since 2.5 */ - public Measure setVariation3(Double variation3) { + public Measure setVariation3(@Nullable Double variation3) { this.variation3 = variation3; return this; } @@ -278,6 +302,7 @@ public class Measure extends Model { * Variation value on period 4. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. * @since 2.5 */ + @CheckForNull public Double getVariation4() { return variation4; } @@ -285,7 +310,7 @@ public class Measure extends Model { /** * @since 2.5 */ - public Measure setVariation4(Double variation4) { + public Measure setVariation4(@Nullable Double variation4) { this.variation4 = variation4; return this; } @@ -294,6 +319,7 @@ public class Measure extends Model { * Variation value on period 5. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. * @since 2.5 */ + @CheckForNull public Double getVariation5() { return variation5; } @@ -301,7 +327,7 @@ public class Measure extends Model { /** * @since 2.5 */ - public Measure setVariation5(Double variation5) { + public Measure setVariation5(@Nullable Double variation5) { this.variation5 = variation5; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Metric.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Metric.java index 2fd7ae50077..de636b6a186 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Metric.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Metric.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + public class Metric extends Model { private String key; @@ -30,74 +33,82 @@ public class Metric extends Model { private Boolean userManaged; private Boolean hidden; + @CheckForNull public String getKey() { return key; } - public Metric setKey(String key) { + public Metric setKey(@Nullable String key) { this.key = key; return this; } + @CheckForNull public String getName() { return name; } - public Metric setName(String name) { + public Metric setName(@Nullable String name) { this.name = name; return this; } + @CheckForNull public int getDirection() { return direction; } - public Metric setDirection(int direction) { + public Metric setDirection(@Nullable int direction) { this.direction = direction; return this; } + @CheckForNull public String getDomain() { return domain; } - public Metric setDomain(String domain) { + public Metric setDomain(@Nullable String domain) { this.domain = domain; return this; } + @CheckForNull public String getDescription() { return description; } - public Metric setDescription(String description) { + public Metric setDescription(@Nullable String description) { this.description = description; return this; } + @CheckForNull public String getType() { return type; } - public Metric setType(String type) { + public Metric setType(@Nullable String type) { this.type = type; return this; } + @CheckForNull public Boolean getHidden() { return hidden; } - public Metric setHidden(Boolean hidden) { + public Metric setHidden(@Nullable Boolean hidden) { this.hidden = hidden; return this; } + @CheckForNull public Boolean getUserManaged() { return userManaged; } - public Metric setUserManaged(Boolean userManaged) { + public Metric setUserManaged(@Nullable Boolean userManaged) { this.userManaged = userManaged; return this; } @@ -105,10 +116,10 @@ public class Metric extends Model { @Override public String toString() { return new StringBuilder() - .append(name) - .append("(") - .append(key) - .append(")") - .toString(); + .append(name) + .append("(") + .append(key) + .append(")") + .toString(); } } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java index 4dfde5bac7b..98d630c568d 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + /** * @since 2.4 */ @@ -28,29 +31,32 @@ public class Plugin extends Model { private String name; private String version; + @CheckForNull public String getKey() { return key; } - public Plugin setKey(String key) { + public Plugin setKey(@Nullable String key) { this.key = key; return this; } + @CheckForNull public String getName() { return name; } - public Plugin setName(String name) { + public Plugin setName(@Nullable String name) { this.name = name; return this; } + @CheckForNull public String getVersion() { return version; } - public Plugin setVersion(String version) { + public Plugin setVersion(@Nullable String version) { this.version = version; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Profile.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Profile.java index 6a73fa34b1d..d709e970e78 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Profile.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Profile.java @@ -20,6 +20,9 @@ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.*; /** @@ -33,20 +36,22 @@ public class Profile extends Model { private String parentName; private List<Rule> rules = new ArrayList<Rule>(); + @CheckForNull public String getLanguage() { return language; } - public Profile setLanguage(String s) { + public Profile setLanguage(@Nullable String s) { this.language = s; return this; } + @CheckForNull public String getName() { return name; } - public Profile setName(String name) { + public Profile setName(@Nullable String name) { this.name = name; return this; } @@ -55,7 +60,7 @@ public class Profile extends Model { return defaultProfile; } - public Profile setDefaultProfile(boolean b) { + public Profile setDefaultProfile(@Nullable boolean b) { this.defaultProfile = b; return this; } @@ -64,7 +69,8 @@ public class Profile extends Model { return parentName; } - public Profile setParentName(String s) { + @CheckForNull + public Profile setParentName(@Nullable String s) { this.parentName = s; return this; } @@ -94,38 +100,42 @@ public class Profile extends Model { private String inheritance; private Map<String,String> parameters; + @CheckForNull public String getKey() { return key; } - public Rule setKey(String key) { + public Rule setKey(@Nullable String key) { this.key = key; return this; } + @CheckForNull public String getRepository() { return repository; } - public Rule setRepository(String repository) { + public Rule setRepository(@Nullable String repository) { this.repository = repository; return this; } + @CheckForNull public String getSeverity() { return severity; } - public Rule setSeverity(String severity) { + public Rule setSeverity(@Nullable String severity) { this.severity = severity; return this; } + @CheckForNull public String getInheritance() { return inheritance; } - public Rule setInheritance(String inheritance) { + public Rule setInheritance(@Nullable String inheritance) { this.inheritance = inheritance; return this; } @@ -141,7 +151,7 @@ public class Profile extends Model { return getParameters().get(key); } - public Rule addParameter(String key, String value) { + public Rule addParameter(@Nullable String key, @Nullable String value) { if (parameters==null) { parameters = new HashMap<String,String>(); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Property.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Property.java index 6cea8355cd5..5dfed27d43d 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Property.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Property.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + public class Property extends Model { private String key; @@ -32,20 +35,22 @@ public class Property extends Model { public Property() { } + @CheckForNull public String getKey() { return key; } - public Property setKey(String key) { + public Property setKey(@Nullable String key) { this.key = key; return this; } + @CheckForNull public String getValue() { return value; } - public Property setValue(String value) { + public Property setValue(@Nullable String value) { this.value = value; return this; } @@ -53,11 +58,11 @@ public class Property extends Model { @Override public String toString() { return new StringBuilder() - .append('[') - .append(key) - .append(':') - .append(value) - .append(']') - .toString(); + .append('[') + .append(key) + .append(':') + .append(value) + .append(']') + .toString(); } } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java index b5996c64363..7983e585643 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.Collections; import java.util.Date; import java.util.List; @@ -64,37 +67,42 @@ public class Resource extends Model { private String period1Param, period2Param, period3Param, period4Param, period5Param; private Date period1Date, period2Date, period3Date, period4Date, period5Date; + @CheckForNull public Integer getId() { return id; } - public Resource setId(Integer id) { + public Resource setId(@Nullable Integer id) { this.id = id; return this; } + @CheckForNull public String getKey() { return key; } - public Resource setKey(String key) { + public Resource setKey(@Nullable String key) { this.key = key; return this; } + @CheckForNull public String getDescription() { return description; } - public Resource setDescription(String description) { + public Resource setDescription(@Nullable String description) { this.description = description; return this; } + @CheckForNull public String getName() { return name; } + @CheckForNull public String getName(boolean longFormatIfDefined) { if (longFormatIfDefined && longName != null && !"".equals(longName)) { return longName; @@ -102,79 +110,87 @@ public class Resource extends Model { return name; } + @CheckForNull public String getLongName() { return longName; } - public Resource setLongName(String longName) { + public Resource setLongName(@Nullable String longName) { this.longName = longName; return this; } - public Resource setName(String s) { + public Resource setName(@Nullable String s) { this.name = s; return this; } + @CheckForNull public String getScope() { return scope; } - public Resource setScope(String scope) { + public Resource setScope(@Nullable String scope) { this.scope = scope; return this; } + @CheckForNull public String getQualifier() { return qualifier; } - public Resource setQualifier(String qualifier) { + public Resource setQualifier(@Nullable String qualifier) { this.qualifier = qualifier; return this; } + @CheckForNull public String getLanguage() { return language; } - public Resource setLanguage(String language) { + public Resource setLanguage(@Nullable String language) { this.language = language; return this; } + @CheckForNull public String getVersion() { return version; } - public Resource setVersion(String version) { + public Resource setVersion(@Nullable String version) { this.version = version; return this; } + @CheckForNull public Integer getCopy() { return copy; } - public Resource setCopy(Integer copy) { + public Resource setCopy(@Nullable Integer copy) { this.copy = copy; return this; } + @CheckForNull public Date getDate() { return date; } - public Resource setDate(Date d) { + public Resource setDate(@Nullable Date d) { this.date = d; return this; } + @CheckForNull public Date getCreationDate() { return creationDate; } - public Resource setCreationDate(Date d) { + public Resource setCreationDate(@Nullable Date d) { this.creationDate = d; return this; } @@ -226,6 +242,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod1Mode() { return period1Mode; } @@ -233,7 +250,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod1Mode(String period1Mode) { + public Resource setPeriod1Mode(@Nullable String period1Mode) { this.period1Mode = period1Mode; return this; } @@ -241,6 +258,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod2Mode() { return period2Mode; } @@ -248,7 +266,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod2Mode(String period2Mode) { + public Resource setPeriod2Mode(@Nullable String period2Mode) { this.period2Mode = period2Mode; return this; } @@ -256,6 +274,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod3Mode() { return period3Mode; } @@ -263,7 +282,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod3Mode(String period3Mode) { + public Resource setPeriod3Mode(@Nullable String period3Mode) { this.period3Mode = period3Mode; return this; } @@ -271,6 +290,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod4Mode() { return period4Mode; } @@ -278,7 +298,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod4Mode(String period4Mode) { + public Resource setPeriod4Mode(@Nullable String period4Mode) { this.period4Mode = period4Mode; return this; } @@ -286,6 +306,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod5Mode() { return period5Mode; } @@ -293,7 +314,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod5Mode(String period5Mode) { + public Resource setPeriod5Mode(@Nullable String period5Mode) { this.period5Mode = period5Mode; return this; } @@ -301,6 +322,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod1Param() { return period1Param; } @@ -308,7 +330,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod1Param(String period1Param) { + public Resource setPeriod1Param(@Nullable String period1Param) { this.period1Param = period1Param; return this; } @@ -316,6 +338,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod2Param() { return period2Param; } @@ -323,7 +346,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod2Param(String period2Param) { + public Resource setPeriod2Param(@Nullable String period2Param) { this.period2Param = period2Param; return this; } @@ -331,6 +354,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod3Param() { return period3Param; } @@ -338,7 +362,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod3Param(String period3Param) { + public Resource setPeriod3Param(@Nullable String period3Param) { this.period3Param = period3Param; return this; } @@ -346,6 +370,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod4Param() { return period4Param; } @@ -353,7 +378,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod4Param(String period4Param) { + public Resource setPeriod4Param(@Nullable String period4Param) { this.period4Param = period4Param; return this; } @@ -361,6 +386,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public String getPeriod5Param() { return period5Param; } @@ -368,7 +394,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod5Param(String period5Param) { + public Resource setPeriod5Param(@Nullable String period5Param) { this.period5Param = period5Param; return this; } @@ -376,6 +402,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public Date getPeriod1Date() { return period1Date; } @@ -383,7 +410,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod1Date(Date period1Date) { + public Resource setPeriod1Date(@Nullable Date period1Date) { this.period1Date = period1Date; return this; } @@ -391,6 +418,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public Date getPeriod2Date() { return period2Date; } @@ -398,7 +426,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod2Date(Date period2Date) { + public Resource setPeriod2Date(@Nullable Date period2Date) { this.period2Date = period2Date; return this; } @@ -406,6 +434,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public Date getPeriod3Date() { return period3Date; } @@ -413,7 +442,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod3Date(Date period3Date) { + public Resource setPeriod3Date(@Nullable Date period3Date) { this.period3Date = period3Date; return this; } @@ -421,6 +450,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public Date getPeriod4Date() { return period4Date; } @@ -428,7 +458,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod4Date(Date period4Date) { + public Resource setPeriod4Date(@Nullable Date period4Date) { this.period4Date = period4Date; return this; } @@ -436,6 +466,7 @@ public class Resource extends Model { /** * @since 2.5 only on projects, else null */ + @CheckForNull public Date getPeriod5Date() { return period5Date; } @@ -443,7 +474,7 @@ public class Resource extends Model { /** * @since 2.5 */ - public Resource setPeriod5Date(Date period5Date) { + public Resource setPeriod5Date(@Nullable Date period5Date) { this.period5Date = period5Date; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceSearchResult.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceSearchResult.java index 4ef315153cc..83abf7f37bb 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceSearchResult.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceSearchResult.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.List; public class ResourceSearchResult extends Model { @@ -26,27 +29,30 @@ public class ResourceSearchResult extends Model { public static class Resource { private String key, name, qualifier; + @CheckForNull public String key() { return key; } + @CheckForNull public String name() { return name; } + @CheckForNull public String qualifier() { return qualifier; } - public void setKey(String key) { + public void setKey(@Nullable String key) { this.key = key; } - public void setName(String s) { + public void setName(@Nullable String s) { this.name = s; } - public void setQualifier(String qualifier) { + public void setQualifier(@Nullable String qualifier) { this.qualifier = qualifier; } } @@ -67,11 +73,11 @@ public class ResourceSearchResult extends Model { return resources; } - public void setPage(int page) { + public void setPage(@Nullable int page) { this.page = page; } - public void setTotal(int total) { + public void setTotal(@Nullable int total) { this.total = total; } @@ -79,7 +85,7 @@ public class ResourceSearchResult extends Model { return pageSize; } - public void setPageSize(int pageSize) { + public void setPageSize(@Nullable int pageSize) { this.pageSize = pageSize; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java index 8b63e8ca5bc..a9810921231 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Rule.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.List; /** @@ -35,20 +38,22 @@ public class Rule extends Model { private List<RuleParam> params; private boolean active; + @CheckForNull public String getTitle() { return title; } - public Rule setTitle(String title) { + public Rule setTitle(@Nullable String title) { this.title = title; return this; } + @CheckForNull public String getKey() { return key; } - public Rule setKey(String key) { + public Rule setKey(@Nullable String key) { this.key = key; return this; } @@ -56,6 +61,7 @@ public class Rule extends Model { /** * @since 2.7 */ + @CheckForNull public String getConfigKey() { return configKey; } @@ -64,34 +70,37 @@ public class Rule extends Model { * @since 2.7 */ - public Rule setConfigKey(String s) { + public Rule setConfigKey(@Nullable String s) { this.configKey = s; return this; } + @CheckForNull public String getRepository() { return repository; } - public Rule setRepository(String s) { + public Rule setRepository(@Nullable String s) { this.repository = s; return this; } + @CheckForNull public String getDescription() { return description; } - public Rule setDescription(String description) { + public Rule setDescription(@Nullable String description) { this.description = description; return this; } + @CheckForNull public String getSeverity() { return severity; } - public Rule setSeverity(String severity) { + public Rule setSeverity(@Nullable String severity) { this.severity = severity; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleParam.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleParam.java index c90d261fcec..cba38634442 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleParam.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/RuleParam.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + /** * @since 2.5 */ @@ -30,29 +33,32 @@ public class RuleParam { private String value; + @CheckForNull public String getName() { return name; } - public RuleParam setName(String name) { + public RuleParam setName(@Nullable String name) { this.name = name; return this; } + @CheckForNull public String getDescription() { return description; } - public RuleParam setDescription(String description) { + public RuleParam setDescription(@Nullable String description) { this.description = description; return this; } + @CheckForNull public String getValue() { return value; } - public RuleParam setValue(String value) { + public RuleParam setValue(@Nullable String value) { this.value = value; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Server.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Server.java index 88a9d5874f9..1576a7c1a2a 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Server.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Server.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + /** * @author Evgeny Mandrikov */ @@ -40,28 +43,32 @@ public class Server extends Model { private Status status; private String statusMessage; + @CheckForNull public String getVersion() { return version; } + @CheckForNull public String getId() { return id; } - public Server setVersion(String s) { + public Server setVersion(@Nullable String s) { this.version = s; return this; } - public Server setId(String id) { + public Server setId(@Nullable String id) { this.id = id; return this; } + @CheckForNull public Status getStatus() { return status; } + @CheckForNull public String getStatusMessage() { return statusMessage; } @@ -71,7 +78,7 @@ public class Server extends Model { return this; } - public Server setStatusMessage(String statusMessage) { + public Server setStatusMessage(@Nullable String statusMessage) { this.statusMessage = statusMessage; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ServerSetup.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ServerSetup.java index 912b3ee190d..656dc09430e 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ServerSetup.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ServerSetup.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + /** * @since 2.9 */ @@ -26,20 +29,22 @@ public class ServerSetup extends Model { private String status; private String message; + @CheckForNull public String getStatus() { return status; } - public ServerSetup setStatus(String status) { + public ServerSetup setStatus(@Nullable String status) { this.status = status; return this; } + @CheckForNull public String getMessage() { return message; } - public ServerSetup setMessage(String message) { + public ServerSetup setMessage(@Nullable String message) { this.message = message; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Source.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Source.java index 61854f28d1e..6d534e1d8de 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Source.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Source.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.Collection; import java.util.SortedMap; import java.util.TreeMap; @@ -35,6 +38,7 @@ public class Source extends Model { return lines; } + @CheckForNull public String getLine(int index) { return lines.get(index); } @@ -43,7 +47,7 @@ public class Source extends Model { return lines.size(); } - public Source addLine(int index, String line) { + public Source addLine(int index, @Nullable String line) { lines.put(index, line); return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineCell.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineCell.java index 7ccfd194a02..0d549365e7d 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineCell.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineCell.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.Date; /** @@ -29,11 +32,12 @@ public class TimeMachineCell { private Date date; public Object[] values; - public TimeMachineCell(Date date, Object[] values) { + public TimeMachineCell(@Nullable Date date, Object[] values) { this.date = date; this.values = values; } + @CheckForNull public Date getDate() { return date; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java index fbd41ac18b7..2a58590d2d5 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java @@ -19,6 +19,9 @@ */ package org.sonar.wsclient.services; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.Date; /** @@ -38,17 +41,19 @@ public class Violation extends Model { private Date createdAt = null; private boolean switchedOff; + @CheckForNull public String getMessage() { return message; } - public void setMessage(String message) { + public void setMessage(@Nullable String message) { this.message = message; } /** * @since 2.5 */ + @CheckForNull public String getSeverity() { return severity; } @@ -56,7 +61,7 @@ public class Violation extends Model { /** * @since 2.5 */ - public void setSeverity(String severity) { + public void setSeverity(@Nullable String severity) { this.severity = severity; } @@ -80,11 +85,12 @@ public class Violation extends Model { * @return line number (numeration starts from 1), or <code>null</code> if violation doesn't belong to concrete line * @see #hasLine() */ + @CheckForNull public Integer getLine() { return line; } - public void setLine(Integer line) { + public void setLine(@Nullable Integer line) { if (line != null && line < 1) { /* * This shouldn't happen, however line would be normalized to null if web service returns incorrect value (less than 1) in compliance @@ -104,46 +110,51 @@ public class Violation extends Model { return line != null; } + @Nullable public String getResourceKey() { return resourceKey; } - public void setResourceKey(String resourceKey) { + public void setResourceKey(@Nullable String resourceKey) { this.resourceKey = resourceKey; } + @CheckForNull public String getRuleKey() { return ruleKey; } - public Violation setRuleKey(String s) { + public Violation setRuleKey(@Nullable String s) { this.ruleKey = s; return this; } + @CheckForNull public String getRuleName() { return ruleName; } - public Violation setRuleName(String ruleName) { + public Violation setRuleName(@Nullable String ruleName) { this.ruleName = ruleName; return this; } + @CheckForNull public String getResourceName() { return resourceName; } - public Violation setResourceName(String resourceName) { + public Violation setResourceName(@Nullable String resourceName) { this.resourceName = resourceName; return this; } + @CheckForNull public String getResourceQualifier() { return resourceQualifier; } - public Violation setResourceQualifier(String resourceQualifier) { + public Violation setResourceQualifier(@Nullable String resourceQualifier) { this.resourceQualifier = resourceQualifier; return this; } @@ -151,6 +162,7 @@ public class Violation extends Model { /** * @since 2.5 */ + @CheckForNull public Date getCreatedAt() { return createdAt; } @@ -158,7 +170,7 @@ public class Violation extends Model { /** * @since 2.5 */ - public Violation setCreatedAt(Date createdAt) { + public Violation setCreatedAt(@Nullable Date createdAt) { this.createdAt = createdAt; return this; } @@ -173,7 +185,7 @@ public class Violation extends Model { /** * @since 2.8 */ - public Violation setSwitchedOff(Boolean b) { + public Violation setSwitchedOff(@Nullable Boolean b) { this.switchedOff = (b != null && b); return this; } @@ -181,6 +193,7 @@ public class Violation extends Model { /** * @since 2.8 */ + @Nullable public boolean isSwitchedOff() { return switchedOff; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshaller.java index ae590298f5e..011aa893d22 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshaller.java @@ -31,7 +31,6 @@ import java.util.List; */ public class ResourceSearchUnmarshaller extends AbstractUnmarshaller<ResourceSearchResult> { - @Override protected ResourceSearchResult parse(Object json) { WSUtils utils = WSUtils.getINSTANCE(); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java index 71730da4cf2..7730105c843 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java @@ -24,6 +24,8 @@ import org.sonar.wsclient.services.TimeMachineCell; import org.sonar.wsclient.services.TimeMachineColumn; import org.sonar.wsclient.services.WSUtils; +import javax.annotation.Nullable; + public class TimeMachineUnmarshaller extends AbstractUnmarshaller<TimeMachine> { @Override @@ -34,7 +36,7 @@ public class TimeMachineUnmarshaller extends AbstractUnmarshaller<TimeMachine> { return new TimeMachine(toColumns(cols), toCells(cells)); } - private TimeMachineColumn[] toColumns(Object cols) { + private TimeMachineColumn[] toColumns(@Nullable Object cols) { WSUtils utils = WSUtils.getINSTANCE(); int size = utils.getArraySize(cols); TimeMachineColumn[] result = new TimeMachineColumn[size]; @@ -45,7 +47,7 @@ public class TimeMachineUnmarshaller extends AbstractUnmarshaller<TimeMachine> { return result; } - private TimeMachineCell[] toCells(Object cells) { + private TimeMachineCell[] toCells(@Nullable Object cells) { WSUtils utils = WSUtils.getINSTANCE(); int size = utils.getArraySize(cells); TimeMachineCell[] result = new TimeMachineCell[size]; |