1 /* 2 * Copyright (C) 2015 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.functional.nullables; 18 19 import javax.inject.Inject; 20 import javax.inject.Provider; 21 22 class NullFoo { 23 final String string; 24 final Provider<String> stringProvider; 25 final Number number; 26 final Provider<Number> numberProvider; 27 28 @Inject NullFoo(@ullable String string, Provider<String> stringProvider, Number number, Provider<Number> numberProvider)29 NullFoo(@Nullable String string, 30 Provider<String> stringProvider, 31 Number number, 32 Provider<Number> numberProvider) { 33 this.string = string; 34 this.stringProvider = stringProvider; 35 this.number = number; 36 this.numberProvider = numberProvider; 37 } 38 39 String methodInjectedString; 40 Provider<String> methodInjectedStringProvider; 41 Number methodInjectedNumber; 42 Provider<Number> methodInjectedNumberProvider; inject(@ullable String string, Provider<String> stringProvider, Number number, Provider<Number> numberProvider)43 @Inject void inject(@Nullable String string, 44 Provider<String> stringProvider, 45 Number number, 46 Provider<Number> numberProvider) { 47 this.methodInjectedString = string; 48 this.methodInjectedStringProvider = stringProvider; 49 this.methodInjectedNumber = number; 50 this.methodInjectedNumberProvider = numberProvider; 51 } 52 53 @Nullable @Inject String fieldInjectedString; 54 @Inject Provider<String> fieldInjectedStringProvider; 55 @Inject Number fieldInjectedNumber; 56 @Inject Provider<Number> fieldInjectedNumberProvider; 57 } 58