RevisionApi: Convert some methods to default methods

Change-Id: Ieda2c06c5fc81ef60c199ac2fc55474537e704a6
This commit is contained in:
Dave Borowitz
2018-11-07 12:56:41 -08:00
parent 124b110261
commit 84621e3d79
2 changed files with 20 additions and 70 deletions

View File

@@ -35,7 +35,9 @@ import java.util.Set;
public interface RevisionApi {
@Deprecated
void delete() throws RestApiException;
default void delete() throws RestApiException {
throw new UnsupportedOperationException("draft workflow is discontinued");
}
String description() throws RestApiException;
@@ -43,22 +45,32 @@ public interface RevisionApi {
ReviewResult review(ReviewInput in) throws RestApiException;
void submit() throws RestApiException;
default void submit() throws RestApiException {
SubmitInput in = new SubmitInput();
submit(in);
}
void submit(SubmitInput in) throws RestApiException;
BinaryResult submitPreview() throws RestApiException;
default BinaryResult submitPreview() throws RestApiException {
return submitPreview("zip");
}
BinaryResult submitPreview(String format) throws RestApiException;
@Deprecated
void publish() throws RestApiException;
default void publish() throws RestApiException {
throw new UnsupportedOperationException("draft workflow is discontinued");
}
ChangeApi cherryPick(CherryPickInput in) throws RestApiException;
CherryPickChangeInfo cherryPickAsInfo(CherryPickInput in) throws RestApiException;
ChangeApi rebase() throws RestApiException;
default ChangeApi rebase() throws RestApiException {
RebaseInput in = new RebaseInput();
return rebase(in);
}
ChangeApi rebase(RebaseInput in) throws RestApiException;
@@ -70,7 +82,9 @@ public interface RevisionApi {
Set<String> reviewed() throws RestApiException;
Map<String, FileInfo> files() throws RestApiException;
default Map<String, FileInfo> files() throws RestApiException {
return files(null);
}
Map<String, FileInfo> files(@Nullable String base) throws RestApiException;
@@ -166,33 +180,16 @@ public interface RevisionApi {
* interface.
*/
class NotImplemented implements RevisionApi {
@Deprecated
@Override
public void delete() throws RestApiException {
throw new NotImplementedException();
}
@Override
public ReviewResult review(ReviewInput in) throws RestApiException {
throw new NotImplementedException();
}
@Override
public void submit() throws RestApiException {
throw new NotImplementedException();
}
@Override
public void submit(SubmitInput in) throws RestApiException {
throw new NotImplementedException();
}
@Deprecated
@Override
public void publish() throws RestApiException {
throw new NotImplementedException();
}
@Override
public ChangeApi cherryPick(CherryPickInput in) throws RestApiException {
throw new NotImplementedException();
@@ -203,11 +200,6 @@ public interface RevisionApi {
throw new NotImplementedException();
}
@Override
public ChangeApi rebase() throws RestApiException {
throw new NotImplementedException();
}
@Override
public ChangeApi rebase(RebaseInput in) throws RestApiException {
throw new NotImplementedException();
@@ -253,11 +245,6 @@ public interface RevisionApi {
throw new NotImplementedException();
}
@Override
public Map<String, FileInfo> files() throws RestApiException {
throw new NotImplementedException();
}
@Override
public List<String> queryFiles(String query) throws RestApiException {
throw new NotImplementedException();
@@ -348,11 +335,6 @@ public interface RevisionApi {
throw new NotImplementedException();
}
@Override
public BinaryResult submitPreview() throws RestApiException {
throw new NotImplementedException();
}
@Override
public BinaryResult submitPreview(String format) throws RestApiException {
throw new NotImplementedException();

View File

@@ -227,12 +227,6 @@ class RevisionApiImpl implements RevisionApi {
}
}
@Override
public void submit() throws RestApiException {
SubmitInput in = new SubmitInput();
submit(in);
}
@Override
public void submit(SubmitInput in) throws RestApiException {
try {
@@ -242,11 +236,6 @@ class RevisionApiImpl implements RevisionApi {
}
}
@Override
public BinaryResult submitPreview() throws RestApiException {
return submitPreview("zip");
}
@Override
public BinaryResult submitPreview(String format) throws RestApiException {
try {
@@ -257,22 +246,6 @@ class RevisionApiImpl implements RevisionApi {
}
}
@Override
public void publish() throws RestApiException {
throw new UnsupportedOperationException("draft workflow is discontinued");
}
@Override
public void delete() throws RestApiException {
throw new UnsupportedOperationException("draft workflow is discontinued");
}
@Override
public ChangeApi rebase() throws RestApiException {
RebaseInput in = new RebaseInput();
return rebase(in);
}
@Override
public ChangeApi rebase(RebaseInput in) throws RestApiException {
try {
@@ -365,11 +338,6 @@ class RevisionApiImpl implements RevisionApi {
}
}
@Override
public Map<String, FileInfo> files() throws RestApiException {
return files(null);
}
@SuppressWarnings("unchecked")
@Override
public Map<String, FileInfo> files(@Nullable String base) throws RestApiException {