CreateChange: Don't use Factory

Circular dependency was removed:

  ChangeJson depends on ChangesCollection
  ChangesCollection depends on CreateChange
  CreateChange depends on ChangeJson

and now CreateChange can be used directly in ChangesCollection.
The enables us to move both (ChangesCollection and CreateChange)
in singelton scope.

Change-Id: I896cfa562305aa5121bbc61ade4196dd78d624f9
This commit is contained in:
David Ostrovsky
2014-05-27 18:03:11 +02:00
committed by Shawn Pearce
parent bb3af5ced7
commit 7141ba2fbb
4 changed files with 19 additions and 22 deletions

View File

@@ -44,7 +44,7 @@ public class ChangesCollection implements
private final ChangeControl.GenericFactory changeControlFactory;
private final Provider<QueryChanges> queryFactory;
private final DynamicMap<RestView<ChangeResource>> views;
private final CreateChange.Factory createChangeFactory;
private final CreateChange createChange;
@Inject
ChangesCollection(
@@ -53,13 +53,13 @@ public class ChangesCollection implements
ChangeControl.GenericFactory changeControlFactory,
Provider<QueryChanges> queryFactory,
DynamicMap<RestView<ChangeResource>> views,
CreateChange.Factory createChangeFactory) {
CreateChange createChange) {
this.db = dbProvider;
this.user = user;
this.changeControlFactory = changeControlFactory;
this.queryFactory = queryFactory;
this.views = views;
this.createChangeFactory = createChangeFactory;
this.createChange = createChange;
}
@Override
@@ -135,6 +135,6 @@ public class ChangesCollection implements
@SuppressWarnings("unchecked")
@Override
public CreateChange post(TopLevelResource parent) throws RestApiException {
return createChangeFactory.create();
return createChange;
}
}