Add not-implemented-class to CommentApi and DraftApi

All other extensions-api interfaces already provide such a class.
It allows us to add new methods without breaking source compatibility
of implementations.

Change-Id: Ic14914709aba2490c3b6bfe927a62c01bc4637a8
This commit is contained in:
Urs Wolfer 2015-01-11 14:16:41 +01:00
parent 5c616c99e6
commit 4c725ccc08
2 changed files with 30 additions and 0 deletions

View File

@ -15,8 +15,20 @@
package com.google.gerrit.extensions.api.changes;
import com.google.gerrit.extensions.common.CommentInfo;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
public interface CommentApi {
CommentInfo get() throws RestApiException;
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
**/
public class NotImplemented implements CommentApi {
@Override
public CommentInfo get() throws RestApiException {
throw new NotImplementedException();
}
}
}

View File

@ -15,9 +15,27 @@
package com.google.gerrit.extensions.api.changes;
import com.google.gerrit.extensions.common.CommentInfo;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
public interface DraftApi extends CommentApi {
CommentInfo update(DraftInput in) throws RestApiException;
void delete() throws RestApiException;
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
**/
public class NotImplemented extends CommentApi.NotImplemented
implements DraftApi {
@Override
public CommentInfo update(DraftInput in) throws RestApiException {
throw new NotImplementedException();
}
@Override
public void delete() throws RestApiException {
throw new NotImplementedException();
}
}
}