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 app; 18 19 import dagger.Component; 20 import javax.inject.Singleton; 21 import library1.AssistedFoo; 22 import library1.Foo; 23 import library1.MyBaseComponent; 24 import library1.MyComponentDependency; 25 import library1.MyComponentDependencyBinding; 26 import library1.MyComponentModule; 27 import library1.MyQualifier; 28 import library1.MySubcomponentWithBuilder; 29 import library1.MySubcomponentWithFactory; 30 31 @Singleton 32 @Component(dependencies = MyComponentDependency.class, modules = MyComponentModule.class) 33 abstract class MyComponent extends MyBaseComponent { foo()34 abstract Foo foo(); 35 assistedFooFactory()36 abstract AssistedFoo.Factory assistedFooFactory(); 37 38 @MyQualifier scopedQualifiedBindsType()39 abstract MyComponentModule.ScopedQualifiedBindsType scopedQualifiedBindsType(); 40 scopedUnqualifiedBindsType()41 abstract MyComponentModule.ScopedUnqualifiedBindsType scopedUnqualifiedBindsType(); 42 43 @MyQualifier unscopedQualifiedBindsType()44 abstract MyComponentModule.UnscopedQualifiedBindsType unscopedQualifiedBindsType(); 45 unscopedUnqualifiedBindsType()46 abstract MyComponentModule.UnscopedUnqualifiedBindsType unscopedUnqualifiedBindsType(); 47 48 @MyQualifier scopedQualifiedProvidesType()49 abstract MyComponentModule.ScopedQualifiedProvidesType scopedQualifiedProvidesType(); 50 scopedUnqualifiedProvidesType()51 abstract MyComponentModule.ScopedUnqualifiedProvidesType scopedUnqualifiedProvidesType(); 52 53 @MyQualifier unscopedQualifiedProvidesType()54 abstract MyComponentModule.UnscopedQualifiedProvidesType unscopedQualifiedProvidesType(); 55 unscopedUnqualifiedProvidesType()56 abstract MyComponentModule.UnscopedUnqualifiedProvidesType unscopedUnqualifiedProvidesType(); 57 mySubcomponentWithFactory()58 abstract MySubcomponentWithFactory.Factory mySubcomponentWithFactory(); 59 mySubcomponentWithBuilder()60 abstract MySubcomponentWithBuilder.Builder mySubcomponentWithBuilder(); 61 62 @MyQualifier qualifiedMyComponentDependencyBinding()63 abstract MyComponentDependencyBinding qualifiedMyComponentDependencyBinding(); 64 unqualifiedMyComponentDependencyBinding()65 abstract MyComponentDependencyBinding unqualifiedMyComponentDependencyBinding(); 66 67 @Component.Factory 68 abstract static class Factory extends MyBaseComponent.Factory { create( MyComponentModule myComponentModule, MyComponentDependency myComponentDependency)69 public abstract MyComponent create( 70 MyComponentModule myComponentModule, 71 MyComponentDependency myComponentDependency); 72 } 73 } 74