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