org.sonatype.guice.bean.locators
Class DefaultBeanLocator

java.lang.Object
  extended by org.sonatype.guice.bean.locators.DefaultBeanLocator
All Implemented Interfaces:
BeanLocator, MutableBeanLocator

@Singleton
public final class DefaultBeanLocator
extends java.lang.Object
implements MutableBeanLocator

Default BeanLocator that locates qualified beans across a dynamic group of Injectors.


Constructor Summary
DefaultBeanLocator()
           
 
Method Summary
 void add(com.google.inject.Injector injector)
          Adds qualified beans belonging to the given injector to any exposed/watched sequences.
 void clear()
          Removes all known qualified beans from any exposed/watched sequences.
<Q extends java.lang.annotation.Annotation,T>
java.lang.Iterable<QualifiedBean<Q,T>>
locate(com.google.inject.Key<T> key, java.lang.Runnable notify)
          Locates beans that match the given qualified binding Key.
 void remove(com.google.inject.Injector injector)
          Removes qualified beans belonging to the given injector from any exposed/watched sequences.
<Q extends java.lang.annotation.Annotation,T,W>
void
watch(com.google.inject.Key<T> key, Mediator<Q,T,W> mediator, W watcher)
          Watches out for beans that match the given qualified binding Key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBeanLocator

public DefaultBeanLocator()
Method Detail

locate

public <Q extends java.lang.annotation.Annotation,T> java.lang.Iterable<QualifiedBean<Q,T>> locate(com.google.inject.Key<T> key,
                                                                                                   java.lang.Runnable notify)
Description copied from interface: BeanLocator
Locates beans that match the given qualified binding Key.

Specified by:
locate in interface BeanLocator
Parameters:
key - The qualified key
notify - Optional callback; called when the bean sequence changes
Returns:
Sequence of beans that match the given key

watch

public <Q extends java.lang.annotation.Annotation,T,W> void watch(com.google.inject.Key<T> key,
                                                                  Mediator<Q,T,W> mediator,
                                                                  W watcher)
Description copied from interface: BeanLocator
Watches out for beans that match the given qualified binding Key.
The Mediator mediates bean events between locator and watcher.

Specified by:
watch in interface BeanLocator
Parameters:
key - The qualified key
mediator - The update mediator
watcher - The bean watcher

add

@Inject
public void add(com.google.inject.Injector injector)
Description copied from interface: MutableBeanLocator
Adds qualified beans belonging to the given injector to any exposed/watched sequences.

Specified by:
add in interface MutableBeanLocator
Parameters:
injector - The new injector

remove

public void remove(com.google.inject.Injector injector)
Description copied from interface: MutableBeanLocator
Removes qualified beans belonging to the given injector from any exposed/watched sequences.

Specified by:
remove in interface MutableBeanLocator
Parameters:
injector - The old injector

clear

public void clear()
Description copied from interface: MutableBeanLocator
Removes all known qualified beans from any exposed/watched sequences.

Specified by:
clear in interface MutableBeanLocator


Copyright © 2010-2011 Sonatype, Inc.. All Rights Reserved.