• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
23 import java.lang.reflect.Constructor;
24 
25 /**
26  * See the EDSL examples at {@link com.google.inject.Binder}.
27  *
28  * @author crazybob@google.com (Bob Lee)
29  */
30 public interface LinkedBindingBuilder<T> extends ScopedBindingBuilder {
31 
32   /**
33    * See the EDSL examples at {@link com.google.inject.Binder}.
34    */
to(Class<? extends T> implementation)35   ScopedBindingBuilder to(Class<? extends T> implementation);
36 
37   /**
38    * See the EDSL examples at {@link com.google.inject.Binder}.
39    */
to(TypeLiteral<? extends T> implementation)40   ScopedBindingBuilder to(TypeLiteral<? extends T> implementation);
41 
42   /**
43    * See the EDSL examples at {@link com.google.inject.Binder}.
44    */
to(Key<? extends T> targetKey)45   ScopedBindingBuilder to(Key<? extends T> targetKey);
46 
47   /**
48    * See the EDSL examples at {@link com.google.inject.Binder}.
49    *
50    * @see com.google.inject.Injector#injectMembers
51    */
toInstance(T instance)52   void toInstance(T instance);
53 
54   /**
55    * See the EDSL examples at {@link com.google.inject.Binder}.
56    *
57    * @see com.google.inject.Injector#injectMembers
58    */
toProvider(Provider<? extends T> provider)59   ScopedBindingBuilder toProvider(Provider<? extends T> provider);
60 
61   /**
62    * See the EDSL examples at {@link com.google.inject.Binder}.
63    *
64    * @see com.google.inject.Injector#injectMembers
65    * @since 4.0
66    */
toProvider(javax.inject.Provider<? extends T> provider)67   ScopedBindingBuilder toProvider(javax.inject.Provider<? extends T> provider);
68 
69   /**
70    * See the EDSL examples at {@link com.google.inject.Binder}.
71    */
toProvider( Class<? extends javax.inject.Provider<? extends T>> providerType)72   ScopedBindingBuilder toProvider(
73       Class<? extends javax.inject.Provider<? extends T>> providerType);
74 
75   /**
76    * See the EDSL examples at {@link com.google.inject.Binder}.
77    */
toProvider( TypeLiteral<? extends javax.inject.Provider<? extends T>> providerType)78   ScopedBindingBuilder toProvider(
79       TypeLiteral<? extends javax.inject.Provider<? extends T>> providerType);
80 
81   /**
82    * See the EDSL examples at {@link com.google.inject.Binder}.
83    */
toProvider( Key<? extends javax.inject.Provider<? extends T>> providerKey)84   ScopedBindingBuilder toProvider(
85       Key<? extends javax.inject.Provider<? extends T>> providerKey);
86 
87   /**
88    * See the EDSL examples at {@link com.google.inject.Binder}.
89    *
90    * @since 3.0
91    */
toConstructor(Constructor<S> constructor)92   <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor);
93 
94   /**
95    * See the EDSL examples at {@link com.google.inject.Binder}.
96    *
97    * @since 3.0
98    */
toConstructor( Constructor<S> constructor, TypeLiteral<? extends S> type)99   <S extends T> ScopedBindingBuilder toConstructor(
100       Constructor<S> constructor, TypeLiteral<? extends S> type);
101 }
102