1 /* 2 * Copyright (C) 2021 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.android.processor; 18 19 import com.squareup.javapoet.ClassName; 20 import com.squareup.javapoet.TypeName; 21 22 // TODO(bcorso): Dedupe with dagger/internal/codegen/javapoet/TypeNames.java? 23 /** Common names and methods for JavaPoet {@link TypeName} and {@link ClassName} usage. */ 24 public final class TypeNames { 25 26 // Core Dagger classnames 27 public static final ClassName BINDS = ClassName.get("dagger", "Binds"); 28 public static final ClassName CLASS_KEY = ClassName.get("dagger.multibindings", "ClassKey"); 29 public static final ClassName INTO_MAP = ClassName.get("dagger.multibindings", "IntoMap"); 30 public static final ClassName MAP_KEY = ClassName.get("dagger", "MapKey"); 31 public static final ClassName MODULE = ClassName.get("dagger", "Module"); 32 public static final ClassName SUBCOMPONENT = ClassName.get("dagger", "Subcomponent"); 33 public static final ClassName SUBCOMPONENT_FACTORY = SUBCOMPONENT.nestedClass("Factory"); 34 35 // Dagger.android classnames 36 public static final ClassName ANDROID_INJECTION_KEY = 37 ClassName.get("dagger.android", "AndroidInjectionKey"); 38 public static final ClassName ANDROID_INJECTOR = 39 ClassName.get("dagger.android", "AndroidInjector"); 40 public static final ClassName DISPATCHING_ANDROID_INJECTOR = 41 ClassName.get("dagger.android", "DispatchingAndroidInjector"); 42 public static final ClassName ANDROID_INJECTOR_FACTORY = ANDROID_INJECTOR.nestedClass("Factory"); 43 public static final ClassName CONTRIBUTES_ANDROID_INJECTOR = 44 ClassName.get("dagger.android", "ContributesAndroidInjector"); 45 46 // Other classnames 47 public static final ClassName PROVIDER = ClassName.get("javax.inject", "Provider"); 48 public static final ClassName QUALIFIER = ClassName.get("jakarta.inject", "Qualifier"); 49 public static final ClassName QUALIFIER_JAVAX = ClassName.get("javax.inject", "Qualifier"); 50 public static final ClassName SCOPE = ClassName.get("jakarta.inject", "Scope"); 51 public static final ClassName SCOPE_JAVAX = ClassName.get("javax.inject", "Scope"); 52 TypeNames()53 private TypeNames() {} 54 } 55