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.android.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 AndroidClassNames {
25 
26   public static final ClassName APPLICATION_PROVIDER =
27       get("androidx.test.core.app", "ApplicationProvider");
28   public static final ClassName ACTIVITY = get("android.app", "Activity");
29   public static final ClassName COMPONENT_ACTIVITY = get("androidx.activity", "ComponentActivity");
30   public static final ClassName APPLICATION = get("android.app", "Application");
31   public static final ClassName BROADCAST_RECEIVER = get("android.content", "BroadcastReceiver");
32   public static final ClassName SERVICE = get("android.app", "Service");
33   public static final ClassName FRAGMENT =
34       get("androidx.fragment.app", "Fragment");
35   public static final ClassName VIEW = get("android.view", "View");
36 
37   public static final ClassName NULLABLE_INTERNAL = get("android.annotation", "Nullable");
38   public static final ClassName TARGET_API = get("android.annotation", "TargetApi");
39 
40   public static final ClassName CONTEXT = get("android.content", "Context");
41   public static final ClassName CONTEXT_WRAPPER = get("android.content", "ContextWrapper");
42   public static final ClassName INTENT = get("android.content", "Intent");
43 
44   public static final ClassName BUNDLE = get("android.os", "Bundle");
45 
46   public static final ClassName CALL_SUPER = get("androidx.annotation", "CallSuper");
47   public static final ClassName MAIN_THREAD = get("androidx.annotation", "MainThread");
48   public static final ClassName NULLABLE = get("androidx.annotation", "Nullable");
49   public static final ClassName MULTI_DEX_APPLICATION =
50       get("androidx.multidex", "MultiDexApplication");
51 
52   public static final ClassName ATTRIBUTE_SET = get("android.util", "AttributeSet");
53   public static final ClassName LAYOUT_INFLATER = get("android.view", "LayoutInflater");
54 
55   public static final ClassName ANDROID_ENTRY_POINT =
56       get("dagger.hilt.android", "AndroidEntryPoint");
57   public static final ClassName WITH_FRAGMENT_BINDINGS =
58       get("dagger.hilt.android", "WithFragmentBindings");
59   public static final ClassName HILT_ANDROID_APP =
60       get("dagger.hilt.android", "HiltAndroidApp");
61   public static final ClassName OPTIONAL_INJECT =
62       get("dagger.hilt.android.migration", "OptionalInject");
63 
64   public static final ClassName SINGLETON_COMPONENT =
65       get("dagger.hilt.components", "SingletonComponent");
66   public static final ClassName ACTIVITY_COMPONENT =
67       get("dagger.hilt.android.components", "ActivityComponent");
68   public static final ClassName ACTIVITY_RETAINED_COMPONENT =
69       get("dagger.hilt.android.components", "ActivityRetainedComponent");
70   public static final ClassName FRAGMENT_COMPONENT =
71       get("dagger.hilt.android.components", "FragmentComponent");
72   public static final ClassName VIEW_WITH_FRAGMENT_COMPONENT =
73       get("dagger.hilt.android.components", "ViewWithFragmentComponent");
74   public static final ClassName VIEW_COMPONENT =
75       get("dagger.hilt.android.components", "ViewComponent");
76   public static final ClassName SERVICE_COMPONENT =
77       get("dagger.hilt.android.components", "ServiceComponent");
78   public static final ClassName VIEW_MODEL_COMPONENT =
79       get("dagger.hilt.android.components", "ViewModelComponent");
80 
81   public static final ClassName ACTIVITY_COMPONENT_MANAGER =
82       get("dagger.hilt.android.internal.managers", "ActivityComponentManager");
83   public static final ClassName APPLICATION_COMPONENT_MANAGER =
84       get("dagger.hilt.android.internal.managers", "ApplicationComponentManager");
85   public static final ClassName BROADCAST_RECEIVER_COMPONENT_MANAGER =
86       get("dagger.hilt.android.internal.managers", "BroadcastReceiverComponentManager");
87   public static final ClassName COMPONENT_SUPPLIER =
88       get("dagger.hilt.android.internal.managers", "ComponentSupplier");
89   public static final ClassName FRAGMENT_COMPONENT_MANAGER =
90       get("dagger.hilt.android.internal.managers", "FragmentComponentManager");
91   public static final ClassName SERVICE_COMPONENT_MANAGER =
92       get("dagger.hilt.android.internal.managers", "ServiceComponentManager");
93   public static final ClassName VIEW_COMPONENT_MANAGER =
94       get("dagger.hilt.android.internal.managers", "ViewComponentManager");
95 
96   public static final ClassName INJECTED_BY_HILT =
97       get("dagger.hilt.android.internal.migration", "InjectedByHilt");
98 
99   public static final ClassName APPLICATION_CONTEXT_MODULE =
100       get("dagger.hilt.android.internal.modules", "ApplicationContextModule");
101 
102   public static final ClassName DEFAULT_VIEW_MODEL_FACTORIES =
103       get("dagger.hilt.android.internal.lifecycle", "DefaultViewModelFactories");
104   public static final ClassName HILT_VIEW_MODEL =
105       get("dagger.hilt.android.lifecycle", "HiltViewModel");
106   public static final ClassName HILT_VIEW_MODEL_MAP_QUALIFIER =
107       get("dagger.hilt.android.internal.lifecycle", "HiltViewModelMap");
108   public static final ClassName HILT_VIEW_MODEL_KEYS_QUALIFIER =
109       get("dagger.hilt.android.internal.lifecycle", "HiltViewModelMap", "KeySet");
110   public static final ClassName VIEW_MODEL = get("androidx.lifecycle", "ViewModel");
111   public static final ClassName VIEW_MODEL_PROVIDER_FACTORY =
112       get("androidx.lifecycle", "ViewModelProvider", "Factory");
113   public static final ClassName SAVED_STATE_HANDLE =
114       get("androidx.lifecycle", "SavedStateHandle");
115 
AndroidClassNames()116   private AndroidClassNames() {}
117 }
118