roboguice.event
Class ObservesTypeListener

java.lang.Object
  extended by roboguice.event.ObservesTypeListener
All Implemented Interfaces:
com.google.inject.spi.TypeListener

public class ObservesTypeListener
extends Object
implements com.google.inject.spi.TypeListener

Guice driven type listener which scans for the @Observes annotations. Registers these methods with the EventManager.

Author:
Adam Tybor, John Ericksen

Nested Class Summary
static class ObservesTypeListener.ContextObserverMethodInjector<I>
          Injection listener to handle the observation manager registration.
 
Field Summary
protected  com.google.inject.Provider<android.content.Context> contextProvider
           
protected  EventManager eventManager
           
 
Constructor Summary
ObservesTypeListener(com.google.inject.Provider<android.content.Context> contextProvider, EventManager eventManager)
           
 
Method Summary
protected  void checkMethodParameters(Method method)
          Error checking method, verifies that the method has the correct number of parameters.
protected
<I> void
findContextObserver(Method method, com.google.inject.spi.TypeEncounter<I> iTypeEncounter)
           
<I> void
hear(com.google.inject.TypeLiteral<I> iTypeLiteral, com.google.inject.spi.TypeEncounter<I> iTypeEncounter)
           
protected
<I> void
registerContextObserver(com.google.inject.spi.TypeEncounter<I> iTypeEncounter, Method method, Class parameterType)
          Error checks the observed method and registers method with typeEncounter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventManager

protected EventManager eventManager

contextProvider

protected com.google.inject.Provider<android.content.Context> contextProvider
Constructor Detail

ObservesTypeListener

public ObservesTypeListener(com.google.inject.Provider<android.content.Context> contextProvider,
                            EventManager eventManager)
Method Detail

hear

public <I> void hear(com.google.inject.TypeLiteral<I> iTypeLiteral,
                     com.google.inject.spi.TypeEncounter<I> iTypeEncounter)
Specified by:
hear in interface com.google.inject.spi.TypeListener

findContextObserver

protected <I> void findContextObserver(Method method,
                                       com.google.inject.spi.TypeEncounter<I> iTypeEncounter)

registerContextObserver

protected <I> void registerContextObserver(com.google.inject.spi.TypeEncounter<I> iTypeEncounter,
                                           Method method,
                                           Class parameterType)
Error checks the observed method and registers method with typeEncounter

Type Parameters:
I -
Parameters:
iTypeEncounter -
method -
parameterType -

checkMethodParameters

protected void checkMethodParameters(Method method)
Error checking method, verifies that the method has the correct number of parameters.

Parameters:
method -


Copyright © 2011. All Rights Reserved.