1 /* 2 * Copyright (C) 2018 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.internal.codegen; 18 19 import dagger.BindsInstance; 20 import dagger.Subcomponent; 21 import dagger.internal.codegen.ComponentImplementationBuilder.RootComponentImplementationBuilder; 22 import dagger.internal.codegen.ComponentImplementationBuilder.SubcomponentImplementationBuilder; 23 import java.util.Optional; 24 25 /** 26 * A subcomponent that injects all objects that are responsible for creating a single {@link 27 * ComponentImplementation} instance. Each child {@link ComponentImplementation} will have its own 28 * instance of {@link CurrentImplementationSubcomponent}. 29 */ 30 @Subcomponent(modules = GenerationOptionsModule.class) 31 @PerComponentImplementation 32 interface CurrentImplementationSubcomponent { rootComponentBuilder()33 RootComponentImplementationBuilder rootComponentBuilder(); 34 subcomponentBuilder()35 SubcomponentImplementationBuilder subcomponentBuilder(); 36 37 @Subcomponent.Builder 38 interface Builder { 39 @BindsInstance componentImplementation(ComponentImplementation componentImplementation)40 Builder componentImplementation(ComponentImplementation componentImplementation); 41 42 @BindsInstance bindingGraph(BindingGraph bindingGraph)43 Builder bindingGraph(BindingGraph bindingGraph); 44 45 @BindsInstance parentBuilder(@arentComponent Optional<ComponentImplementationBuilder> parentBuilder)46 Builder parentBuilder(@ParentComponent Optional<ComponentImplementationBuilder> parentBuilder); 47 48 @BindsInstance parentBindingExpressions( @arentComponent Optional<ComponentBindingExpressions> parentBindingExpressions)49 Builder parentBindingExpressions( 50 @ParentComponent Optional<ComponentBindingExpressions> parentBindingExpressions); 51 52 @BindsInstance parentRequirementExpressions( @arentComponent Optional<ComponentRequirementExpressions> parentRequirementExpressions)53 Builder parentRequirementExpressions( 54 @ParentComponent Optional<ComponentRequirementExpressions> parentRequirementExpressions); 55 build()56 CurrentImplementationSubcomponent build(); 57 } 58 } 59