MCPcopy Create free account
hub / github.com/google/guice / forInstance

Method forInstance

core/src/com/google/inject/internal/Scoping.java:191–219  ·  view source on GitHub ↗
(final Scope scope)

Source from the content-addressed store, hash-verified

189 }
190
191 public static Scoping forInstance(final Scope scope) {
192 if (scope == Scopes.SINGLETON) {
193 return SINGLETON_INSTANCE;
194 } else if (scope == Scopes.NO_SCOPE) {
195 return EXPLICITLY_UNSCOPED;
196 }
197
198 return new Scoping() {
199 @Override
200 public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
201 return visitor.visitScope(scope);
202 }
203
204 @Override
205 public Scope getScopeInstance() {
206 return scope;
207 }
208
209 @Override
210 public String toString() {
211 return scope.toString();
212 }
213
214 @Override
215 public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
216 scopedBindingBuilder.in(scope);
217 }
218 };
219 }
220
221 /**
222 * Returns true if this scope was explicitly applied. If no scope was explicitly applied then the

Callers 2

makeInjectableMethod · 0.95
inMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected