Make BranchResource and TagResource extend a common class
Add a new abstract class, RefResource, that defines access methods to get the ref name and revision. Make both BranchResource and TagResource derive from RefResource, and add the missing implementations in TagResource. This will make it easier to consolidate common code that can be used for both branch and tag related endpoints. Change-Id: Ib44d621e34ce2b1077349db0037d960155b790e0
This commit is contained in:
@@ -19,7 +19,7 @@ import com.google.gerrit.extensions.restapi.RestView;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
public class BranchResource extends ProjectResource {
|
||||
public class BranchResource extends RefResource {
|
||||
public static final TypeLiteral<RestView<BranchResource>> BRANCH_KIND =
|
||||
new TypeLiteral<RestView<BranchResource>>() {};
|
||||
|
||||
@@ -38,10 +38,12 @@ public class BranchResource extends ProjectResource {
|
||||
return new Branch.NameKey(getNameKey(), branchInfo.ref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRef() {
|
||||
return branchInfo.ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevision() {
|
||||
return branchInfo.revision;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user