use of com.google.gwt.inject.rebind.binding.ParentBinding in project google-gin by gwtplus.
the class GinjectorBindings method determineScope.
public GinScope determineScope(Key<?> key) {
assertFinalized();
GinScope scope = scopes.get(key);
if (scope == null) {
Class<?> raw = key.getTypeLiteral().getRawType();
Binding binding = bindings.get(key);
if (binding != null && (binding instanceof ExposedChildBinding || binding instanceof ParentBinding)) {
// If this is just a "copy" of a binding higher/lower in the injector
// tree, we prefer to treat the binding like it's unscoped, and refer to
// the "real" binding every time we need the value.
scope = GinScope.NO_SCOPE;
} else if (raw.getAnnotation(Singleton.class) != null || raw.getAnnotation(javax.inject.Singleton.class) != null) {
// Look for scope annotation as a fallback
scope = GinScope.SINGLETON;
} else if (RemoteServiceProxyBinding.isRemoteServiceProxy(key.getTypeLiteral())) {
// Special case for remote services
scope = GinScope.SINGLETON;
} else {
scope = GinScope.NO_SCOPE;
}
}
logger.log(TreeLogger.TRACE, "scope for " + key + ": " + scope);
return scope;
}
Aggregations