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 ASSISTED_INJECT = get("dagger.assisted", "AssistedInject"); 76 public static final ClassName BINDS = 77 get("dagger", "Binds"); 78 public static final ClassName BINDS_OPTIONAL_OF = 79 get("dagger", "BindsOptionalOf"); 80 public static final ClassName MODULE = get("dagger", "Module"); 81 public static final ClassName MULTIBINDS = 82 get("dagger.multibindings", "Multibinds"); 83 public static final ClassName INTO_MAP = get("dagger.multibindings", "IntoMap"); 84 public static final ClassName INTO_SET = get("dagger.multibindings", "IntoSet"); 85 public static final ClassName STRING_KEY = get("dagger.multibindings", "StringKey"); 86 public static final ClassName PROVIDES = 87 get("dagger", "Provides"); 88 public static final ClassName COMPONENT = get("dagger", "Component"); 89 public static final ClassName COMPONENT_BUILDER = get("dagger", "Component", "Builder"); 90 public static final ClassName SUBCOMPONENT = get("dagger", "Subcomponent"); 91 public static final ClassName SUBCOMPONENT_BUILDER = 92 get("dagger", "Subcomponent", "Builder"); 93 public static final ClassName PRODUCTION_COMPONENT = 94 get("dagger.producers", "ProductionComponent"); 95 96 public static final ClassName CONTRIBUTES_ANDROID_INJECTOR = 97 get("dagger.android", "ContributesAndroidInjector"); 98 99 public static final ClassName INJECT = 100 get("javax.inject", "Inject"); 101 public static final ClassName QUALIFIER = 102 get("javax.inject", "Qualifier"); 103 public static final ClassName SCOPE = 104 get("javax.inject", "Scope"); 105 public static final ClassName PROVIDER = get("javax.inject", "Provider"); 106 public static final ClassName DISABLE_INSTALL_IN_CHECK = 107 get("dagger.hilt.migration", "DisableInstallInCheck"); 108 public static final ClassName ALIAS_OF = get("dagger.hilt.migration", "AliasOf"); 109 public static final ClassName ALIAS_OF_PROPAGATED_DATA = 110 get("dagger.hilt.internal.aliasof", "AliasOfPropagatedData"); 111 public static final String ALIAS_OF_PROPAGATED_DATA_PACKAGE = 112 "dagger.hilt.processor.internal.aliasof.codegen"; 113 114 public static final ClassName GENERATES_ROOT_INPUT = get("dagger.hilt", "GeneratesRootInput"); 115 public static final ClassName GENERATES_ROOT_INPUT_PROPAGATED_DATA = 116 get("dagger.hilt.internal.generatesrootinput", "GeneratesRootInputPropagatedData"); 117 118 public static final ClassName ACTIVITY_SCOPED = 119 get("dagger.hilt.android.scopes", "ActivityScoped"); 120 public static final ClassName FRAGMENT_SCOPED = 121 get("dagger.hilt.android.scopes", "FragmentScoped"); 122 public static final ClassName SERVICE_SCOPED = get("dagger.hilt.android.scopes", "ServiceScoped"); 123 public static final ClassName VIEW_SCOPED = get("dagger.hilt.android.scopes", "ViewScoped"); 124 125 public static final ClassName INSTALL_IN = 126 get("dagger.hilt", "InstallIn"); 127 public static final ClassName TEST_INSTALL_IN = get("dagger.hilt.testing", "TestInstallIn"); 128 public static final ClassName ENTRY_POINT = 129 get("dagger.hilt", "EntryPoint"); 130 public static final ClassName ENTRY_POINTS = get("dagger.hilt", "EntryPoints"); 131 public static final ClassName COMPONENT_ENTRY_POINT = 132 get("dagger.hilt.internal", "ComponentEntryPoint"); 133 public static final ClassName GENERATED_ENTRY_POINT = 134 get("dagger.hilt.internal", "GeneratedEntryPoint"); 135 public static final ClassName UNSAFE_CASTS = get("dagger.hilt.internal", "UnsafeCasts"); 136 public static final ClassName ROOT_PROCESSOR = 137 get("dagger.hilt.processor.internal.root", "RootProcessor"); 138 139 public static final ClassName SINGLETON = get("javax.inject", "Singleton"); 140 141 // TODO(erichang): Move these class names out when we factor out the android portion 142 public static final ClassName APPLICATION = get("android.app", "Application"); 143 public static final ClassName MULTI_DEX_APPLICATION = 144 get("androidx.multidex", "MultiDexApplication"); 145 public static final ClassName ANDROID_ENTRY_POINT = 146 get("dagger.hilt.android", "AndroidEntryPoint"); 147 public static final ClassName HILT_ANDROID_APP = 148 get("dagger.hilt.android", "HiltAndroidApp"); 149 public static final ClassName CONTEXT = get("android.content", "Context"); 150 public static final ClassName APPLICATION_PROVIDER = 151 get("androidx.test.core.app", "ApplicationProvider"); 152 public static final ClassName COMPONENT_SUPPLIER = 153 get("dagger.hilt.android.internal.managers", "ComponentSupplier"); 154 public static final ClassName APPLICATION_CONTEXT_MODULE = 155 get("dagger.hilt.android.internal.modules", "ApplicationContextModule"); 156 public static final ClassName DEFAULT_ROOT = 157 ClassName.get("dagger.hilt.android.internal.testing.root", "Default"); 158 public static final ClassName INTERNAL_TEST_ROOT = 159 get("dagger.hilt.android.internal.testing", "InternalTestRoot"); 160 public static final ClassName TEST_INJECTOR = 161 get("dagger.hilt.android.internal.testing", "TestInjector"); 162 public static final ClassName TEST_APPLICATION_COMPONENT_MANAGER = 163 get("dagger.hilt.android.internal.testing", "TestApplicationComponentManager"); 164 public static final ClassName TEST_APPLICATION_COMPONENT_MANAGER_HOLDER = 165 get("dagger.hilt.android.internal.testing", "TestApplicationComponentManagerHolder"); 166 public static final ClassName TEST_INSTANCE_HOLDER = 167 get("dagger.hilt.android.internal.testing", "TestInstanceHolder"); 168 public static final ClassName HILT_ANDROID_TEST = 169 get("dagger.hilt.android.testing", "HiltAndroidTest"); 170 public static final ClassName CUSTOM_TEST_APPLICATION = 171 get("dagger.hilt.android.testing", "CustomTestApplication"); 172 public static final ClassName ON_COMPONENT_READY_RUNNER = 173 get("dagger.hilt.android.testing", "OnComponentReadyRunner"); 174 public static final ClassName ON_COMPONENT_READY_RUNNER_HOLDER = 175 get("dagger.hilt.android.testing", "OnComponentReadyRunner", "OnComponentReadyRunnerHolder"); 176 public static final ClassName ANDROID_BIND_VALUE = 177 get("dagger.hilt.android.testing", "BindValue"); 178 public static final ClassName ANDROID_BIND_ELEMENTS_INTO_SET = 179 get("dagger.hilt.android.testing", "BindElementsIntoSet"); 180 public static final ClassName ANDROID_BIND_VALUE_INTO_MAP = 181 get("dagger.hilt.android.testing", "BindValueIntoMap"); 182 public static final ClassName ANDROID_BIND_VALUE_INTO_SET = 183 get("dagger.hilt.android.testing", "BindValueIntoSet"); 184 public static final ClassName APPLICATION_CONTEXT = 185 get("dagger.hilt.android.qualifiers", "ApplicationContext"); 186 public static final ClassName TEST_SINGLETON_COMPONENT = 187 get("dagger.hilt.internal", "TestSingletonComponent"); 188 public static final ClassName TEST_COMPONENT_DATA = 189 get("dagger.hilt.android.internal.testing", "TestComponentData"); 190 public static final ClassName TEST_COMPONENT_DATA_SUPPLIER = 191 get("dagger.hilt.android.internal.testing", "TestComponentDataSupplier"); 192 193 public static final ClassName CLASS = get("java.lang", "Class"); 194 public static final ClassName LIST = get("java.util", "List"); 195 public static final ClassName SET = get("java.util", "Set"); 196 public static final ClassName MAP = get("java.util", "Map"); 197 public static final ClassName HASH_MAP = get("java.util", "HashMap"); 198 public static final ClassName HASH_SET = get("java.util", "HashSet"); 199 public static final ClassName COLLECTIONS = get("java.util", "Collections"); 200 public static final ClassName ARRAYS = get("java.util", "Arrays"); 201 202 // Standard components 203 public static final ClassName SINGLETON_COMPONENT = 204 get("dagger.hilt.components", "SingletonComponent"); 205 public static final ClassName ACTIVITY_COMPONENT = 206 get("dagger.hilt.android.components", "ActivityComponent"); 207 208 public static final ClassName PRECONDITIONS = get("dagger.hilt.internal", "Preconditions"); 209 210 public static final ClassName OBJECT = get("java.lang", "Object"); 211 212 public static final ClassName SUPPRESS_WARNINGS = get("java.lang", "SuppressWarnings"); 213 public static final ClassName KOTLIN_SUPPRESS = get("kotlin", "Suppress"); 214 215 // Kotlin-specific class names 216 public static final ClassName KOTLIN_METADATA = get("kotlin", "Metadata"); 217 ClassNames()218 private ClassNames() {} 219 } 220