Revision: 04cdfd9c98f6
Author: Sam Berlin <[email protected]>
Date: Tue Jan 17 08:29:38 2012
Log: Remove duplicate code & instead delegate to Scopes.isScoped
method.
Revision created by MOE tool push_codebase.
MOE_MIGRATION=4089
http://code.google.com/p/google-guice/source/detail?r=04cdfd9c98f6
Modified:
/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
=======================================
--- /extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
Fri Jan 13 15:20:50 2012
+++ /extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
Tue Jan 17 08:29:38 2012
@@ -254,51 +254,7 @@
* also return true if the target binding is request-scoped.
*/
public static boolean isRequestScoped(Binding<?> binding) {
- do {
- boolean requestScoped = binding.acceptScopingVisitor(new
BindingScopingVisitor<Boolean>() {
- @Override
- public Boolean visitNoScoping() {
- return false;
- }
-
- @Override
- public Boolean visitScopeAnnotation(Class<? extends Annotation>
scopeAnnotation) {
- return scopeAnnotation == RequestScoped.class;
- }
-
- @Override
- public Boolean visitScope(Scope scope) {
- return scope == ServletScopes.REQUEST;
- }
-
- @Override
- public Boolean visitEagerSingleton() {
- return false;
- }
- });
-
- if (requestScoped) {
- return true;
- }
-
- if (binding instanceof LinkedBindingImpl) {
- LinkedBindingImpl<?> linkedBinding = (LinkedBindingImpl<?>)
binding;
- Injector injector = linkedBinding.getInjector();
- if (injector != null) {
- binding = injector.getBinding(linkedBinding.getLinkedKey());
- continue;
- }
- } else if (binding instanceof ExposedBinding) {
- ExposedBinding<?> exposedBinding = (ExposedBinding<?>) binding;
- Injector injector =
exposedBinding.getPrivateElements().getInjector();
- if (injector != null) {
- binding = injector.getBinding(exposedBinding.getKey());
- continue;
- }
- }
-
- return false;
- } while (true);
+ return Scopes.isScoped(binding, ServletScopes.REQUEST,
RequestScoped.class);
}
/**
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.