@@ -12,9 +12,18 @@ public final class ServiceRepository<Context, Result>
12
12
implements Cloned <ServiceRepository <Context , Result >> {
13
13
14
14
private final ServicePipeline pipeline ;
15
- private final Service <Context , Result > defaultImplementation ;
16
- final List <ServiceWrapper <Context , Result >> implementations ;
17
15
final TypeToken <? extends Service <Context , Result >> serviceType ;
16
+ final List <ServiceWrapper <Context , Result >> implementations ;
17
+
18
+ private ServiceRepository (
19
+ @ NotNull final ServicePipeline pipeline ,
20
+ @ NotNull final TypeToken <? extends Service <Context , Result >> serviceType ,
21
+ @ NotNull final List <ServiceWrapper <Context , Result >> implementations
22
+ ) {
23
+ this .pipeline = pipeline ;
24
+ this .serviceType = serviceType ;
25
+ this .implementations = implementations ;
26
+ }
18
27
19
28
public ServiceRepository (
20
29
@ NotNull final ServicePipeline pipeline ,
@@ -23,7 +32,6 @@ public ServiceRepository(
23
32
) {
24
33
this .pipeline = pipeline ;
25
34
this .serviceType = serviceType ;
26
- this .defaultImplementation = defaultImplementation ;
27
35
this .implementations = new LinkedList <>();
28
36
this .implementations .add (
29
37
new ServiceWrapper <>(serviceType , defaultImplementation , true , null )
@@ -33,7 +41,11 @@ public ServiceRepository(
33
41
@ NotNull
34
42
@ Override
35
43
public ServiceRepository <Context , Result > cloned () {
36
- return new ServiceRepository <>(this .pipeline , this .serviceType , this .defaultImplementation );
44
+ return new ServiceRepository <>(
45
+ this .pipeline ,
46
+ this .serviceType ,
47
+ new LinkedList <>(this .implementations )
48
+ );
37
49
}
38
50
39
51
public void apply (@ NotNull final Implementation <Context , Result > operation ) {
0 commit comments