Add @Nullable/@NotNull annotations to JIRA API classes

This commit is contained in:
Mikhail Golubev
2014-04-10 13:30:47 +04:00
parent 1b9067eebe
commit 0c7f52f28e
5 changed files with 13 additions and 13 deletions
@@ -24,14 +24,14 @@ public abstract class JiraRemoteApi {
}
@NotNull
public abstract List<Task> findTasks(String jql, int max) throws Exception;
public abstract List<Task> findTasks(@NotNull String jql, int max) throws Exception;
@Nullable
public abstract Task findTask(String key) throws Exception;
public abstract Task findTask(@NotNull String key) throws Exception;
public abstract void setTaskState(Task task, TaskState state) throws Exception;
public abstract void setTaskState(@NotNull Task task, @NotNull TaskState state) throws Exception;
public abstract void updateTimeSpend(LocalTask task, String timeSpent, String comment) throws Exception;
public abstract void updateTimeSpend(@NotNull LocalTask task, @NotNull String timeSpent, String comment) throws Exception;
@NotNull
public final String getVersionName() {
@@ -53,7 +53,7 @@ public abstract class JiraRestApi extends JiraRemoteApi {
@Override
@NotNull
public final List<Task> findTasks(String jql, int max) throws Exception {
public final List<Task> findTasks(@NotNull String jql, int max) throws Exception {
GetMethod method = getMultipleIssuesSearchMethod(jql, max);
String response = myRepository.executeMethod(method);
List<JiraIssue> issues = parseIssues(response);
@@ -68,7 +68,7 @@ public abstract class JiraRestApi extends JiraRemoteApi {
@Override
@Nullable
public final JiraRestTask findTask(String key) throws Exception {
public final JiraRestTask findTask(@NotNull String key) throws Exception {
GetMethod method = getSingleIssueSearchMethod(key);
return new JiraRestTask(parseIssue(myRepository.executeMethod(method)), myRepository);
}
@@ -95,7 +95,7 @@ public abstract class JiraRestApi extends JiraRemoteApi {
protected abstract JiraIssue parseIssue(String response);
@Override
public void setTaskState(Task task, TaskState state) throws Exception {
public void setTaskState(@NotNull Task task, @NotNull TaskState state) throws Exception {
String requestBody = getRequestForStateTransition(state);
LOG.debug(String.format("Transition: %s -> %s, request: %s", task.getState(), state, requestBody));
if (requestBody == null) {
@@ -81,7 +81,7 @@ public class JiraRestApi2 extends JiraRestApi {
}
@Override
public void updateTimeSpend(LocalTask task, String timeSpent, String comment) throws Exception {
public void updateTimeSpend(@NotNull LocalTask task, @NotNull String timeSpent, String comment) throws Exception {
LOG.debug(String.format("Time spend: %s, comment: %s", timeSpent, comment));
PostMethod method = new PostMethod(myRepository.getRestUrl("issue", task.getId(), "worklog"));
String request;
@@ -72,7 +72,7 @@ public class JiraRestApi20Alpha1 extends JiraRestApi {
}
@Override
public void updateTimeSpend(LocalTask task, String timeSpent, String comment) throws Exception {
public void updateTimeSpend(@NotNull LocalTask task, @NotNull String timeSpent, String comment) throws Exception {
throw new Exception(TaskBundle.message("jira.failure.no.time.spent"));
}
@@ -39,7 +39,7 @@ public class JiraSoapApi extends JiraRemoteApi {
@NotNull
@Override
public List<Task> findTasks(String query, int max) throws Exception {
public List<Task> findTasks(@NotNull String query, int max) throws Exception {
// Unfortunately, both SOAP and XML-RPC interfaces of JIRA don't allow fetching *all* tasks from server, but
// only filtered by some search term (see http://stackoverflow.com/questions/764282/how-can-jira-soap-api-not-have-this-method).
@@ -85,7 +85,7 @@ public class JiraSoapApi extends JiraRemoteApi {
@Nullable
@Override
public Task findTask(String key) throws Exception {
public Task findTask(@NotNull String key) throws Exception {
try {
List<Task> tasks = processRSS(new GetMethod(myRepository.getUrl() + RSS_ISSUE_PATH + key + '/' + key + ".xml"));
return tasks.isEmpty() ? null : tasks.get(0);
@@ -103,12 +103,12 @@ public class JiraSoapApi extends JiraRemoteApi {
}
@Override
public void setTaskState(Task task, TaskState state) throws Exception {
public void setTaskState(@NotNull Task task, @NotNull TaskState state) throws Exception {
throw new Exception(TaskBundle.message("jira.failure.no.state.update"));
}
@Override
public void updateTimeSpend(LocalTask task, String timeSpent, String comment) throws Exception {
public void updateTimeSpend(@NotNull LocalTask task, @NotNull String timeSpent, String comment) throws Exception {
throw new Exception(TaskBundle.message("jira.failure.no.time.spent"));
}
}