roboguice.inject
Class ContextScope

java.lang.Object
  extended by roboguice.inject.ContextScope
All Implemented Interfaces:
com.google.inject.Scope

public class ContextScope
extends java.lang.Object
implements com.google.inject.Scope

Author:
Mike Burton

Field Summary
protected  RoboApplication app
           
protected  java.lang.ThreadLocal<java.util.Map<com.google.inject.Key<android.content.Context>,java.lang.Object>> values
           
protected  java.util.ArrayList<roboguice.inject.ViewMembersInjector<?>> viewsForInjection
           
 
Constructor Summary
ContextScope(RoboApplication app)
           
 
Method Summary
 void enter(android.content.Context context)
          Scopes can be entered multiple times with no problems (eg.
 void exit(android.content.Context ignored)
           
protected
<T> java.util.Map<com.google.inject.Key<android.content.Context>,java.lang.Object>
getScopedObjectMap(com.google.inject.Key<T> key)
           
protected  java.util.Map<com.google.inject.Key<android.content.Context>,java.lang.Object> initialScopedObjectMap()
           
 void injectViews()
           
 void registerViewForInjection(roboguice.inject.ViewMembersInjector<?> injector)
           
<T> com.google.inject.Provider<T>
scope(com.google.inject.Key<T> key, com.google.inject.Provider<T> unscoped)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.inject.Scope
toString
 

Field Detail

values

protected final java.lang.ThreadLocal<java.util.Map<com.google.inject.Key<android.content.Context>,java.lang.Object>> values

viewsForInjection

protected java.util.ArrayList<roboguice.inject.ViewMembersInjector<?>> viewsForInjection

app

protected RoboApplication app
Constructor Detail

ContextScope

public ContextScope(RoboApplication app)
Method Detail

enter

public void enter(android.content.Context context)
Scopes can be entered multiple times with no problems (eg. from onCreate(), onStart(), etc). However, once they're closed, all their previous values are gone forever until the scope is reinitialized again via enter().


exit

public void exit(android.content.Context ignored)

registerViewForInjection

public void registerViewForInjection(roboguice.inject.ViewMembersInjector<?> injector)

injectViews

public void injectViews()

scope

public <T> com.google.inject.Provider<T> scope(com.google.inject.Key<T> key,
                                               com.google.inject.Provider<T> unscoped)
Specified by:
scope in interface com.google.inject.Scope

getScopedObjectMap

protected <T> java.util.Map<com.google.inject.Key<android.content.Context>,java.lang.Object> getScopedObjectMap(com.google.inject.Key<T> key)

initialScopedObjectMap

protected java.util.Map<com.google.inject.Key<android.content.Context>,java.lang.Object> initialScopedObjectMap()


Copyright © 2011. All Rights Reserved.