Simplify RestModifyView interface
The inputType can be determined by looking at the declaration of the interface. We don't need to implement a method in each view implementation to supply the correct data for reflection in RestApiServlet. Change-Id: I1afae6ddef661722efe39ccc917c028e7e993595
This commit is contained in:
committed by
Edwin Kempin
parent
63cc8ec1b6
commit
5ab78ad7c2
@@ -65,11 +65,6 @@ public class Abandon implements RestModifyView<ChangeResource, Input> {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ChangeResource req, Input input)
|
||||
throws BadRequestException, AuthException,
|
||||
|
||||
@@ -41,11 +41,6 @@ class CreateDraft implements RestModifyView<RevisionResource, Input> {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<GetDraft.Comment> apply(RevisionResource rsrc, Input in)
|
||||
throws AuthException, BadRequestException, ResourceConflictException, OrmException {
|
||||
|
||||
@@ -35,11 +35,6 @@ class DeleteDraft implements RestModifyView<DraftResource, Input> {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(DraftResource rsrc, Input input) throws OrmException {
|
||||
db.get().patchComments().delete(Collections.singleton(rsrc.getComment()));
|
||||
|
||||
@@ -43,11 +43,6 @@ class DeleteReviewer implements RestModifyView<ReviewerResource, Input> {
|
||||
this.dbProvider = dbProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ReviewerResource rsrc, Input input)
|
||||
throws AuthException, ResourceNotFoundException, OrmException {
|
||||
|
||||
@@ -125,11 +125,6 @@ public class PostReview implements RestModifyView<RevisionResource, Input> {
|
||||
this.hooks = hooks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(RevisionResource revision, Input input)
|
||||
throws AuthException, BadRequestException, OrmException {
|
||||
|
||||
@@ -55,11 +55,6 @@ class PutDraft implements RestModifyView<DraftResource, Input> {
|
||||
this.delete = delete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(DraftResource rsrc, Input in) throws AuthException,
|
||||
BadRequestException, ResourceConflictException, OrmException {
|
||||
|
||||
@@ -48,11 +48,6 @@ class PutTopic implements RestModifyView<ChangeResource, Input> {
|
||||
this.dbProvider = dbProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ChangeResource req, Input input)
|
||||
throws BadRequestException, AuthException,
|
||||
|
||||
@@ -65,11 +65,6 @@ public class Restore implements RestModifyView<ChangeResource, Input> {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ChangeResource req, Input input)
|
||||
throws Exception {
|
||||
|
||||
@@ -83,11 +83,6 @@ public class Revert implements RestModifyView<ChangeResource, Input> {
|
||||
this.canonicalWebUrl = canonicalWebUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ChangeResource req, Input input) throws Exception {
|
||||
ChangeControl control = req.getControl();
|
||||
|
||||
@@ -82,11 +82,6 @@ public class Submit implements RestModifyView<RevisionResource, Input> {
|
||||
this.mergeQueue = mergeQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Output apply(RevisionResource rsrc, Input input) throws AuthException,
|
||||
ResourceConflictException, RepositoryNotFoundException, IOException,
|
||||
@@ -305,11 +300,6 @@ public class Submit implements RestModifyView<RevisionResource, Input> {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ChangeResource rsrc, Input input) throws AuthException,
|
||||
ResourceConflictException, RepositoryNotFoundException, IOException,
|
||||
|
||||
@@ -95,11 +95,6 @@ class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberInfo> apply(GroupResource resource, Input input)
|
||||
throws AuthException, MethodNotAllowedException, BadRequestException,
|
||||
@@ -201,11 +196,6 @@ class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<PutMember.Input> inputType() {
|
||||
return PutMember.Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(GroupResource resource, PutMember.Input input)
|
||||
throws AuthException, MethodNotAllowedException, BadRequestException,
|
||||
@@ -232,11 +222,6 @@ class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
this.get = get;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<PutMember.Input> inputType() {
|
||||
return PutMember.Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(MemberResource resource, PutMember.Input input) {
|
||||
// Do nothing, the user is already a member.
|
||||
|
||||
@@ -56,11 +56,6 @@ public class CreateGroup implements RestModifyView<TopLevelResource, Input> {
|
||||
this.visibleToAll = cfg.getBoolean("groups", "newGroupsVisibleToAll", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupInfo apply(TopLevelResource resource, Input input)
|
||||
throws AuthException, BadRequestException, OrmException,
|
||||
|
||||
@@ -61,11 +61,6 @@ public class DeleteMembers implements RestModifyView<GroupResource, Input> {
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(GroupResource resource, Input input)
|
||||
throws AuthException, MethodNotAllowedException, BadRequestException,
|
||||
@@ -159,11 +154,6 @@ public class DeleteMembers implements RestModifyView<GroupResource, Input> {
|
||||
this.delete = delete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return DeleteMember.Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(MemberResource resource, Input input)
|
||||
throws AuthException, MethodNotAllowedException, BadRequestException,
|
||||
|
||||
@@ -33,11 +33,6 @@ class DisablePlugin implements RestModifyView<PluginResource, Input> {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(PluginResource resource, Input input) {
|
||||
String name = resource.getName();
|
||||
|
||||
@@ -37,11 +37,6 @@ class EnablePlugin implements RestModifyView<PluginResource, Input> {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(PluginResource resource, Input input)
|
||||
throws ResourceConflictException {
|
||||
|
||||
@@ -51,11 +51,6 @@ class InstallPlugin implements RestModifyView<TopLevelResource, Input> {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<ListPlugins.PluginInfo> apply(TopLevelResource resource,
|
||||
Input input) throws BadRequestException, IOException {
|
||||
@@ -105,11 +100,6 @@ class InstallPlugin implements RestModifyView<TopLevelResource, Input> {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<ListPlugins.PluginInfo> apply(PluginResource resource,
|
||||
Input input) throws BadRequestException, IOException {
|
||||
|
||||
@@ -37,11 +37,6 @@ class ReloadPlugin implements RestModifyView<PluginResource, Input> {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(PluginResource resource, Input input) throws ResourceConflictException {
|
||||
String name = resource.getName();
|
||||
|
||||
@@ -35,11 +35,6 @@ class DeleteDashboard implements RestModifyView<DashboardResource, Input> {
|
||||
this.defaultSetter = defaultSetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(DashboardResource resource, Input input)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
|
||||
@@ -38,11 +38,6 @@ class SetDashboard implements RestModifyView<DashboardResource, Input> {
|
||||
this.defaultSetter = defaultSetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(DashboardResource resource, Input input)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
|
||||
@@ -55,11 +55,6 @@ class SetDefaultDashboard implements RestModifyView<DashboardResource, Input> {
|
||||
this.get = get;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(DashboardResource resource, Input input)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
@@ -137,11 +132,6 @@ class SetDefaultDashboard implements RestModifyView<DashboardResource, Input> {
|
||||
this.setDefault = setDefault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return SetDashboard.Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ProjectResource resource, Input input)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
|
||||
@@ -53,11 +53,6 @@ class SetDescription implements RestModifyView<ProjectResource, Input> {
|
||||
this.gitMgr = gitMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ProjectResource resource, Input input)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
|
||||
@@ -53,11 +53,6 @@ class SetParent implements RestModifyView<ProjectResource, Input> {
|
||||
this.allProjects = allProjects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Input> inputType() {
|
||||
return Input.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object apply(ProjectResource resource, Input input)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
|
||||
Reference in New Issue
Block a user