• 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;
18 
19 import static java.lang.annotation.RetentionPolicy.CLASS;
20 
21 import java.lang.annotation.ElementType;
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.Target;
24 
25 /**
26  * Annotation for marking an interface as an entry point into a generated component. This annotation
27  * must be used with {@link dagger.hilt.InstallIn} to indicate which component(s) should have this
28  * entry point. When assembling components, Hilt will make the indicated components extend the
29  * interface marked with this annotation.
30  *
31  * <p>To use the annotated interface to access Dagger objects, use {@link dagger.hilt.EntryPoints}.
32  *
33  * <p>Example usage:
34  *
35  * <pre><code>
36  *   {@literal @}EntryPoint
37  *   {@literal @}InstallIn(SingletonComponent.class)
38  *   public interface FooEntryPoint {
39  *     Foo getFoo();
40  *   }
41  *
42  *   Foo foo = EntryPoints.get(component, FooEntryPoint.class).getFoo();
43  * </code></pre>
44  *
45  * @see <a href="https://dagger.dev/hilt/entry-points">Entry points</a>
46  */
47 @Retention(CLASS)
48 @Target(ElementType.TYPE)
49 @GeneratesRootInput
50 public @interface EntryPoint {}
51