1 /* 2 * Copyright (C) 2017 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; 18 19 import static java.lang.annotation.ElementType.METHOD; 20 import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 22 import java.lang.annotation.Documented; 23 import java.lang.annotation.Retention; 24 import java.lang.annotation.Target; 25 26 /** 27 * Generates an {@link AndroidInjector} for the return type of this method. The injector is 28 * implemented with a {@link dagger.Subcomponent} and will be a child of the {@link dagger.Module}'s 29 * component. 30 * 31 * <p>This annotation must be applied to an abstract method in a {@link dagger.Module} that returns 32 * a concrete Android framework type (e.g. {@code FooActivity}, {@code BarFragment}, {@code 33 * MyService}, etc). The method should have no parameters. 34 * 35 * <p>For more information, see <a href="https://dagger.dev/android">the docs</a> 36 */ 37 @Documented 38 @Retention(RUNTIME) 39 @Target(METHOD) 40 public @interface ContributesAndroidInjector { 41 /** Modules to be installed in the generated {@link dagger.Subcomponent}. */ modules()42 Class<?>[] modules() default {}; 43 } 44