• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Dagger Authors.
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 
17 package dagger.hilt.processor.internal;
18 
19 import static com.squareup.javapoet.ClassName.get;
20 
21 import com.squareup.javapoet.ClassName;
22 
23 /** Holder for commonly used class names. */
24 public final class ClassNames {
25   public static final ClassName AGGREGATED_ELEMENT_PROXY =
26       get("dagger.hilt.android.internal.legacy", "AggregatedElementProxy");
27   public static final ClassName COMPONENT_TREE_DEPS =
28       get("dagger.hilt.internal.componenttreedeps", "ComponentTreeDeps");
29 
30   public static final String AGGREGATED_ROOT_PACKAGE =
31       "dagger.hilt.internal.aggregatedroot.codegen";
32   public static final ClassName AGGREGATED_ROOT =
33       get("dagger.hilt.internal.aggregatedroot", "AggregatedRoot");
34   public static final String PROCESSED_ROOT_SENTINEL_PACKAGE =
35       "dagger.hilt.internal.processedrootsentinel.codegen";
36   public static final ClassName PROCESSED_ROOT_SENTINEL =
37       get("dagger.hilt.internal.processedrootsentinel", "ProcessedRootSentinel");
38 
39   public static final ClassName CONTEXTS = get("dagger.hilt.android.internal", "Contexts");
40 
41   public static final String AGGREGATED_EARLY_ENTRY_POINT_PACKAGE =
42       "dagger.hilt.android.internal.earlyentrypoint.codegen";
43   public static final ClassName AGGREGATED_EARLY_ENTRY_POINT =
44       get("dagger.hilt.android.internal.earlyentrypoint", "AggregatedEarlyEntryPoint");
45   public static final ClassName EARLY_ENTRY_POINT = get("dagger.hilt.android", "EarlyEntryPoint");
46 
47   public static final String AGGREGATED_UNINSTALL_MODULES_PACKAGE =
48       "dagger.hilt.android.internal.uninstallmodules.codegen";
49   public static final ClassName AGGREGATED_UNINSTALL_MODULES =
50       get("dagger.hilt.android.internal.uninstallmodules", "AggregatedUninstallModules");
51 
52   public static final ClassName ORIGINATING_ELEMENT =
53       get("dagger.hilt.codegen", "OriginatingElement");
54   public static final ClassName AGGREGATED_DEPS =
55       get("dagger.hilt.processor.internal.aggregateddeps", "AggregatedDeps");
56   public static final ClassName GENERATED_COMPONENT =
57       get("dagger.hilt.internal", "GeneratedComponent");
58   public static final ClassName GENERATED_COMPONENT_MANAGER =
59       get("dagger.hilt.internal", "GeneratedComponentManager");
60   public static final ClassName GENERATED_COMPONENT_MANAGER_HOLDER =
61       get("dagger.hilt.internal", "GeneratedComponentManagerHolder");
62   public static final ClassName UNINSTALL_MODULES =
63       get("dagger.hilt.android.testing", "UninstallModules");
64 
65   public static final String DEFINE_COMPONENT_CLASSES_PACKAGE =
66       "dagger.hilt.processor.internal.definecomponent.codegen";
67   public static final ClassName DEFINE_COMPONENT = get("dagger.hilt", "DefineComponent");
68   public static final ClassName DEFINE_COMPONENT_BUILDER =
69       get("dagger.hilt", "DefineComponent", "Builder");
70   public static final ClassName DEFINE_COMPONENT_NO_PARENT =
71       get("dagger.hilt.internal.definecomponent", "DefineComponentNoParent");
72   public static final ClassName DEFINE_COMPONENT_CLASSES =
73       get("dagger.hilt.internal.definecomponent", "DefineComponentClasses");
74 
75   public static final ClassName IDENTIFIER_NAME_STRING =
76       get("dagger.internal", "IdentifierNameString");
77 
78   public static final ClassName ASSISTED_INJECT = get("dagger.assisted", "AssistedInject");
79   public static final ClassName ASSISTED_FACTORY = get("dagger.assisted", "AssistedFactory");
80   public static final ClassName BINDS =
81       get("dagger", "Binds");
82   public static final ClassName BINDS_OPTIONAL_OF =
83       get("dagger", "BindsOptionalOf");
84   public static final ClassName MAP_KEY = get("dagger", "MapKey");
85   public static final ClassName MODULE = get("dagger", "Module");
86   public static final ClassName MULTIBINDS =
87       get("dagger.multibindings", "Multibinds");
88   public static final ClassName INTO_MAP = get("dagger.multibindings", "IntoMap");
89   public static final ClassName INTO_SET = get("dagger.multibindings", "IntoSet");
90   public static final ClassName ELEMENTS_INTO_SET = get("dagger.multibindings", "ElementsIntoSet");
91   public static final ClassName STRING_KEY = get("dagger.multibindings", "StringKey");
92   public static final ClassName LAZY_CLASS_KEY = get("dagger.multibindings", "LazyClassKey");
93   public static final ClassName PROVIDES =
94       get("dagger", "Provides");
95   public static final ClassName COMPONENT = get("dagger", "Component");
96   public static final ClassName COMPONENT_BUILDER = get("dagger", "Component", "Builder");
97   public static final ClassName SUBCOMPONENT = get("dagger", "Subcomponent");
98   public static final ClassName SUBCOMPONENT_BUILDER =
99       get("dagger", "Subcomponent", "Builder");
100   public static final ClassName PRODUCTION_COMPONENT =
101       get("dagger.producers", "ProductionComponent");
102 
103   public static final ClassName CONTRIBUTES_ANDROID_INJECTOR =
104       get("dagger.android", "ContributesAndroidInjector");
105 
106   public static final ClassName INJECT =
107       get("javax.inject", "Inject");
108   public static final ClassName QUALIFIER =
109       get("javax.inject", "Qualifier");
110   public static final ClassName SCOPE =
111       get("javax.inject", "Scope");
112   public static final ClassName PROVIDER = get("javax.inject", "Provider");
113   public static final ClassName DISABLE_INSTALL_IN_CHECK =
114       get("dagger.hilt.migration", "DisableInstallInCheck");
115   public static final ClassName ALIAS_OF = get("dagger.hilt.migration", "AliasOf");
116   public static final ClassName ALIAS_OF_PROPAGATED_DATA =
117       get("dagger.hilt.internal.aliasof", "AliasOfPropagatedData");
118   public static final String ALIAS_OF_PROPAGATED_DATA_PACKAGE =
119       "dagger.hilt.processor.internal.aliasof.codegen";
120 
121   public static final ClassName GENERATES_ROOT_INPUT = get("dagger.hilt", "GeneratesRootInput");
122   public static final ClassName GENERATES_ROOT_INPUT_PROPAGATED_DATA =
123       get("dagger.hilt.internal.generatesrootinput", "GeneratesRootInputPropagatedData");
124 
125   public static final ClassName ACTIVITY_SCOPED =
126       get("dagger.hilt.android.scopes", "ActivityScoped");
127   public static final ClassName FRAGMENT_SCOPED =
128       get("dagger.hilt.android.scopes", "FragmentScoped");
129   public static final ClassName SERVICE_SCOPED = get("dagger.hilt.android.scopes", "ServiceScoped");
130   public static final ClassName VIEW_SCOPED = get("dagger.hilt.android.scopes", "ViewScoped");
131 
132   public static final ClassName INSTALL_IN =
133       get("dagger.hilt", "InstallIn");
134   public static final ClassName TEST_INSTALL_IN = get("dagger.hilt.testing", "TestInstallIn");
135   public static final ClassName ENTRY_POINT =
136       get("dagger.hilt", "EntryPoint");
137   public static final ClassName ENTRY_POINTS = get("dagger.hilt", "EntryPoints");
138   public static final ClassName COMPONENT_ENTRY_POINT =
139       get("dagger.hilt.internal", "ComponentEntryPoint");
140   public static final ClassName GENERATED_ENTRY_POINT =
141       get("dagger.hilt.internal", "GeneratedEntryPoint");
142   public static final ClassName UNSAFE_CASTS = get("dagger.hilt.internal", "UnsafeCasts");
143   public static final ClassName ROOT_PROCESSOR =
144       get("dagger.hilt.processor.internal.root", "RootProcessor");
145 
146   public static final ClassName SINGLETON = get("javax.inject", "Singleton");
147 
148   // TODO(erichang): Move these class names out when we factor out the android portion
149   public static final ClassName APPLICATION = get("android.app", "Application");
150   public static final ClassName MULTI_DEX_APPLICATION =
151       get("androidx.multidex", "MultiDexApplication");
152   public static final ClassName ANDROID_ENTRY_POINT =
153       get("dagger.hilt.android", "AndroidEntryPoint");
154   public static final ClassName HILT_ANDROID_APP =
155       get("dagger.hilt.android", "HiltAndroidApp");
156   public static final ClassName CONTEXT = get("android.content", "Context");
157   public static final ClassName APPLICATION_PROVIDER =
158       get("androidx.test.core.app", "ApplicationProvider");
159   public static final ClassName COMPONENT_SUPPLIER =
160       get("dagger.hilt.android.internal.managers", "ComponentSupplier");
161   public static final ClassName APPLICATION_CONTEXT_MODULE =
162       get("dagger.hilt.android.internal.modules", "ApplicationContextModule");
163   public static final ClassName DEFAULT_ROOT =
164       ClassName.get("dagger.hilt.android.internal.testing.root", "Default");
165   public static final ClassName INTERNAL_TEST_ROOT =
166       get("dagger.hilt.android.internal.testing", "InternalTestRoot");
167   public static final ClassName TEST_INJECTOR =
168       get("dagger.hilt.android.internal.testing", "TestInjector");
169   public static final ClassName TEST_APPLICATION_COMPONENT_MANAGER =
170       get("dagger.hilt.android.internal.testing", "TestApplicationComponentManager");
171   public static final ClassName TEST_APPLICATION_COMPONENT_MANAGER_HOLDER =
172       get("dagger.hilt.android.internal.testing", "TestApplicationComponentManagerHolder");
173   public static final ClassName TEST_INSTANCE_HOLDER =
174       get("dagger.hilt.android.internal.testing", "TestInstanceHolder");
175   public static final ClassName HILT_ANDROID_TEST =
176       get("dagger.hilt.android.testing", "HiltAndroidTest");
177   public static final ClassName SKIP_TEST_INJECTION =
178       get("dagger.hilt.android.testing", "SkipTestInjection");
179   public static final ClassName CUSTOM_TEST_APPLICATION =
180       get("dagger.hilt.android.testing", "CustomTestApplication");
181   public static final ClassName ON_COMPONENT_READY_RUNNER =
182       get("dagger.hilt.android.testing", "OnComponentReadyRunner");
183   public static final ClassName ON_COMPONENT_READY_RUNNER_HOLDER =
184       get("dagger.hilt.android.testing", "OnComponentReadyRunner", "OnComponentReadyRunnerHolder");
185   public static final ClassName ANDROID_BIND_VALUE =
186       get("dagger.hilt.android.testing", "BindValue");
187   public static final ClassName ANDROID_BIND_ELEMENTS_INTO_SET =
188       get("dagger.hilt.android.testing", "BindElementsIntoSet");
189   public static final ClassName ANDROID_BIND_VALUE_INTO_MAP =
190       get("dagger.hilt.android.testing", "BindValueIntoMap");
191   public static final ClassName ANDROID_BIND_VALUE_INTO_SET =
192       get("dagger.hilt.android.testing", "BindValueIntoSet");
193   public static final ClassName APPLICATION_CONTEXT =
194       get("dagger.hilt.android.qualifiers", "ApplicationContext");
195   public static final ClassName TEST_SINGLETON_COMPONENT =
196       get("dagger.hilt.internal", "TestSingletonComponent");
197   public static final ClassName TEST_COMPONENT_DATA =
198       get("dagger.hilt.android.internal.testing", "TestComponentData");
199   public static final ClassName TEST_COMPONENT_DATA_SUPPLIER =
200       get("dagger.hilt.android.internal.testing", "TestComponentDataSupplier");
201 
202   public static final ClassName CLASS = get("java.lang", "Class");
203   public static final ClassName LIST = get("java.util", "List");
204   public static final ClassName SET = get("java.util", "Set");
205   public static final ClassName MAP = get("java.util", "Map");
206   public static final ClassName HASH_MAP = get("java.util", "HashMap");
207   public static final ClassName HASH_SET = get("java.util", "HashSet");
208   public static final ClassName COLLECTIONS = get("java.util", "Collections");
209   public static final ClassName ARRAYS = get("java.util", "Arrays");
210 
211   // Standard components
212   public static final ClassName SINGLETON_COMPONENT =
213       get("dagger.hilt.components", "SingletonComponent");
214   public static final ClassName ACTIVITY_COMPONENT =
215       get("dagger.hilt.android.components", "ActivityComponent");
216 
217   public static final ClassName PRECONDITIONS = get("dagger.hilt.internal", "Preconditions");
218 
219   public static final ClassName OBJECT = get("java.lang", "Object");
220 
221   public static final ClassName SUPPRESS_WARNINGS = get("java.lang", "SuppressWarnings");
222   public static final ClassName KOTLIN_SUPPRESS = get("kotlin", "Suppress");
223 
224   public static final ClassName ON_RECEIVE_BYTECODE_INJECTION_MARKER =
225       get("dagger.hilt.android.internal", "OnReceiveBytecodeInjectionMarker");
226 
227   // Kotlin-specific class names
228   public static final ClassName KOTLIN_METADATA = get("kotlin", "Metadata");
229 
ClassNames()230   private ClassNames() {}
231 }
232