1 /* 2 * Copyright (C) 2012 Square, Inc. 3 * Copyright (C) 2009 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package dagger; 18 19 /** 20 * Injects dependencies into the fields and methods on instances of type {@code T}. Ignores the 21 * presence or absence of an injectable constructor. 22 * 23 * @param <T> type to inject members of 24 * 25 * @author Bob Lee 26 * @author Jesse Wilson 27 * @since 2.0 (since 1.0 without the provision that {@link #injectMembers} cannot accept 28 * {@code null}) 29 */ 30 public interface MembersInjector<T> { 31 32 /** 33 * Injects dependencies into the fields and methods of {@code instance}. Ignores the presence or 34 * absence of an injectable constructor. 35 * 36 * <p>Whenever the object graph creates an instance, it performs this injection automatically 37 * (after first performing constructor injection), so if you're able to let the object graph 38 * create all your objects for you, you'll never need to use this method. 39 * 40 * @param instance into which members are to be injected 41 * @throws NullPointerException if {@code instance} is {@code null} 42 */ 43 void injectMembers(T instance); 44 } 45