roboguice.inject
Class ViewListener.ViewMembersInjector<T>
java.lang.Object
roboguice.inject.ViewListener.ViewMembersInjector<T>
- All Implemented Interfaces:
- com.google.inject.MembersInjector<T>
- Enclosing class:
- ViewListener
public static class ViewListener.ViewMembersInjector<T>
- extends Object
- implements com.google.inject.MembersInjector<T>
This class gets twice as many providers as necessary to do its job, look into optimizations in the future if this is a bottleneck
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
viewMembersInjectors
protected static WeakHashMap<Object,ArrayList<ViewListener.ViewMembersInjector<?>>> viewMembersInjectors
field
protected Field field
annotation
protected Annotation annotation
instanceRef
protected WeakReference<T> instanceRef
fragmentManagerProvider
protected com.google.inject.Provider fragmentManagerProvider
activityProvider
protected com.google.inject.Provider<android.app.Activity> activityProvider
ViewListener.ViewMembersInjector
public ViewListener.ViewMembersInjector(Field field,
Annotation annotation,
com.google.inject.spi.TypeEncounter<T> typeEncounter)
injectMembers
public void injectMembers(T instance)
- This is called when instance is injected by guice. Because the views may or may not be set up yet,
we don't do the real view injection until later.
- Specified by:
injectMembers
in interface com.google.inject.MembersInjector<T>
- Parameters:
instance
- the instance being injected by guice
reallyInjectMembers
public void reallyInjectMembers(Object activityOrFragment)
reallyInjectMemberViews
protected void reallyInjectMemberViews(Object activityOrFragment)
- This is when the view references are actually evaluated.
I don't like all the hacks I had to put into this method. Instance is the object you're
injecting into. ActivityOrFragment is the activity or fragment that you're injecting
views into. Instance must equal activityOrFragment is activityOrFragment is a fragment,
but they may differ if activityOrFragment is an activity. They should be allowed to differ
so that you can inject views into arbitrary objects, but I don't know how to determine whether
to get the view from the fragment or the activity for an arbitrary object, so I'm artificially
limiting injection targets to the fragment itself for fragments.
- Parameters:
activityOrFragment
- an activity or fragment
reallyInjectMemberFragments
protected void reallyInjectMemberFragments(Object activityOrFragment)
- This is when the view references are actually evaluated.
- Parameters:
activityOrFragment
- an activity or fragment
injectViews
protected static void injectViews(Object activityOrFragment)
Copyright © 2012. All Rights Reserved.