• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package tests;
17 
18 import javax.annotation.processing.Generated;
19 import javax.inject.Inject;
20 import javax.inject.Provider;
21 
22 /**
23  * @author Gregory Kick
24  */
25 @Generated(
26     value = "com.google.auto.factory.processor.AutoFactoryProcessor",
27     comments = "https://github.com/google/auto/tree/main/factory"
28     )
29 final class MixedDepsImplementingInterfacesFactory
30     implements MixedDepsImplementingInterfaces.FromInt,
31         MixedDepsImplementingInterfaces.FromObject,
32         MixedDepsImplementingInterfaces.MarkerA,
33         MixedDepsImplementingInterfaces.MarkerB {
34   private final Provider<String> sProvider;
35 
36   @Inject
MixedDepsImplementingInterfacesFactory(Provider<String> sProvider)37   MixedDepsImplementingInterfacesFactory(Provider<String> sProvider) {
38     this.sProvider = checkNotNull(sProvider, 1, 1);
39   }
40 
create(int i)41   MixedDepsImplementingInterfaces create(int i) {
42     return new MixedDepsImplementingInterfaces(checkNotNull(sProvider.get(), 1, 2), i);
43   }
44 
create(Object o)45   MixedDepsImplementingInterfaces create(Object o) {
46     return new MixedDepsImplementingInterfaces(checkNotNull(o, 1, 1));
47   }
48 
49   @Override
fromInt(int i)50   public MixedDepsImplementingInterfaces fromInt(int i) {
51     return create(i);
52   }
53 
54   @Override
fromObject(Object o)55   public MixedDepsImplementingInterfaces fromObject(Object o) {
56     return create(o);
57   }
58 
checkNotNull(T reference, int argumentNumber, int argumentCount)59   private static <T> T checkNotNull(T reference, int argumentNumber, int argumentCount) {
60     if (reference == null) {
61       throw new NullPointerException(
62           "@AutoFactory method argument is null but is not marked @Nullable. Argument "
63               + argumentNumber
64               + " of "
65               + argumentCount);
66     }
67     return reference;
68   }
69 }
70