File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\jenkins\ProxyInjector.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2011, CloudBees, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package jenkins;
25
26 import com.google.inject.Binding;
27 import com.google.inject.Injector;
28 import com.google.inject.Key;
29 import com.google.inject.MembersInjector;
30 import com.google.inject.Module;
31 import com.google.inject.Provider;
32 import com.google.inject.Scope;
33 import com.google.inject.TypeLiteral;
34 import com.google.inject.spi.TypeConverterBinding;
35
36 import java.lang.annotation.Annotation;
37 import java.util.List;
38 import java.util.Map;
39 import java.util.Set;
40
41 /**
42 * {@link Injector} that delegates to another one.
43 *
44 * @author Kohsuke Kawaguchi
45 */
46 public abstract class ProxyInjector implements Injector {
47 protected abstract Injector resolve();
48
49 public void injectMembers(Object instance) {
50 resolve().injectMembers(instance);
51 }
52
53 public <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> typeLiteral) {
54 return resolve().getMembersInjector(typeLiteral);
55 }
56
57 public <T> MembersInjector<T> getMembersInjector(Class<T> type) {
58 return resolve().getMembersInjector(type);
59 }
60
61 public Map<Key<?>, Binding<?>> getBindings() {
62 return resolve().getBindings();
63 }
64
65 public Map<Key<?>, Binding<?>> getAllBindings() {
66 return resolve().getAllBindings();
67 }
68
69 public <T> Binding<T> getBinding(Key<T> key) {
70 return resolve().getBinding(key);
71 }
72
73 public <T> Binding<T> getBinding(Class<T> type) {
74 return resolve().getBinding(type);
75 }
76
77 public <T> Binding<T> getExistingBinding(Key<T> key) {
78 return resolve().getExistingBinding(key);
79 }
80
81 public <T> List<Binding<T>> findBindingsByType(TypeLiteral<T> type) {
82 return resolve().findBindingsByType(type);
83 }
84
85 public <T> Provider<T> getProvider(Key<T> key) {
86 return resolve().getProvider(key);
87 }
88
89 public <T> Provider<T> getProvider(Class<T> type) {
90 return resolve().getProvider(type);
91 }
92
93 public <T> T getInstance(Key<T> key) {
94 return resolve().getInstance(key);
95 }
96
97 public <T> T getInstance(Class<T> type) {
98 return resolve().getInstance(type);
99 }
100
101 public Injector getParent() {
102 return resolve().getParent();
103 }
104
105 public Injector createChildInjector(Iterable<? extends Module> modules) {
106 return resolve().createChildInjector(modules);
107 }
108
109 public Injector createChildInjector(Module... modules) {
110 return resolve().createChildInjector(modules);
111 }
112
113 public Map<Class<? extends Annotation>, Scope> getScopeBindings() {
114 return resolve().getScopeBindings();
115 }
116
117 public Set<TypeConverterBinding> getTypeConverterBindings() {
118 return resolve().getTypeConverterBindings();
119 }
120 }
121