Merge "Extend extensions-api Projects with list methods"

This commit is contained in:
Shawn Pearce
2014-05-02 17:41:45 +00:00
committed by Gerrit Code Review

View File

@@ -14,12 +14,67 @@
package com.google.gerrit.extensions.api.projects;
import com.google.gerrit.extensions.common.ProjectInfo;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
import java.util.List;
public interface Projects {
ProjectApi name(String name) throws RestApiException;
List<ProjectInfo> list() throws RestApiException;
List<ProjectInfo> list(ListParameter listParameter) throws RestApiException;
public class ListParameter {
private boolean description;
private String prefix;
private int limit;
private int start;
public ListParameter() {}
public ListParameter(String prefix) {
this.prefix = prefix;
}
public ListParameter withDescription(boolean description) {
this.description = description;
return this;
}
public ListParameter withPrefix(String prefix) {
this.prefix = prefix;
return this;
}
public ListParameter withLimit(int limit) {
this.limit = limit;
return this;
}
public ListParameter withStart(int start) {
this.start = start;
return this;
}
public boolean getDescription() {
return description;
}
public String getPrefix() {
return prefix;
}
public int getLimit() {
return limit;
}
public int getStart() {
return start;
}
}
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
@@ -29,5 +84,15 @@ public interface Projects {
public ProjectApi name(String name) throws RestApiException {
throw new NotImplementedException();
}
@Override
public List<ProjectInfo> list() throws RestApiException {
throw new NotImplementedException();
}
@Override
public List<ProjectInfo> list(ListParameter listParameter) throws RestApiException {
throw new NotImplementedException();
}
}
}