1 /* 2 * Copyright (C) 2006 Google Inc. 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 com.google.inject.binder; 18 19 import com.google.inject.Key; 20 import com.google.inject.Provider; 21 import com.google.inject.TypeLiteral; 22 import java.lang.reflect.Constructor; 23 24 /** 25 * See the EDSL examples at {@link com.google.inject.Binder}. 26 * 27 * @author crazybob@google.com (Bob Lee) 28 */ 29 public interface LinkedBindingBuilder<T> extends ScopedBindingBuilder { 30 31 /** See the EDSL examples at {@link com.google.inject.Binder}. */ to(Class<? extends T> implementation)32 ScopedBindingBuilder to(Class<? extends T> implementation); 33 34 /** See the EDSL examples at {@link com.google.inject.Binder}. */ to(TypeLiteral<? extends T> implementation)35 ScopedBindingBuilder to(TypeLiteral<? extends T> implementation); 36 37 /** See the EDSL examples at {@link com.google.inject.Binder}. */ to(Key<? extends T> targetKey)38 ScopedBindingBuilder to(Key<? extends T> targetKey); 39 40 /** 41 * See the EDSL examples at {@link com.google.inject.Binder}. 42 * 43 * @see com.google.inject.Injector#injectMembers 44 */ toInstance(T instance)45 void toInstance(T instance); 46 47 /** 48 * See the EDSL examples at {@link com.google.inject.Binder}. 49 * 50 * @see com.google.inject.Injector#injectMembers 51 */ toProvider(Provider<? extends T> provider)52 ScopedBindingBuilder toProvider(Provider<? extends T> provider); 53 54 /** 55 * See the EDSL examples at {@link com.google.inject.Binder}. 56 * 57 * @see com.google.inject.Injector#injectMembers 58 * @since 4.0 59 */ toProvider(javax.inject.Provider<? extends T> provider)60 ScopedBindingBuilder toProvider(javax.inject.Provider<? extends T> provider); 61 62 /** See the EDSL examples at {@link com.google.inject.Binder}. */ toProvider(Class<? extends javax.inject.Provider<? extends T>> providerType)63 ScopedBindingBuilder toProvider(Class<? extends javax.inject.Provider<? extends T>> providerType); 64 65 /** See the EDSL examples at {@link com.google.inject.Binder}. */ toProvider( TypeLiteral<? extends javax.inject.Provider<? extends T>> providerType)66 ScopedBindingBuilder toProvider( 67 TypeLiteral<? extends javax.inject.Provider<? extends T>> providerType); 68 69 /** See the EDSL examples at {@link com.google.inject.Binder}. */ toProvider(Key<? extends javax.inject.Provider<? extends T>> providerKey)70 ScopedBindingBuilder toProvider(Key<? extends javax.inject.Provider<? extends T>> providerKey); 71 72 /** 73 * See the EDSL examples at {@link com.google.inject.Binder}. 74 * 75 * @since 3.0 76 */ toConstructor(Constructor<S> constructor)77 <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor); 78 79 /** 80 * See the EDSL examples at {@link com.google.inject.Binder}. 81 * 82 * @since 3.0 83 */ toConstructor( Constructor<S> constructor, TypeLiteral<? extends S> type)84 <S extends T> ScopedBindingBuilder toConstructor( 85 Constructor<S> constructor, TypeLiteral<? extends S> type); 86 } 87