org.sonatype.guice.bean.locators
Class DefaultBeanLocator

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

@Singleton
public final class DefaultBeanLocator
extends Object
implements MutableBeanLocator

Default MutableBeanLocator that locates qualified beans across a dynamic group of BindingPublishers.


Constructor Summary
DefaultBeanLocator()
           
 
Method Summary
 void add(BindingPublisher publisher, int rank)
          Adds the given ranked BindingPublisher and distributes its Bindings.
 void add(com.google.inject.Injector injector, int rank)
          Adds the given ranked Injector and distributes its Bindings.
 void clear()
          Removes all known BindingPublishers and their Bindings.
 Iterable<BeanEntry> locate(com.google.inject.Key key)
          Finds bean implementations that match the given qualified binding Key.
 void remove(BindingPublisher publisher)
          Removes the given BindingPublisher and its Bindings.
 void remove(com.google.inject.Injector injector)
          Removes the given Injector and its Bindings.
 void watch(com.google.inject.Key key, Mediator mediator, Object watcher)
          Tracks bean implementations 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 Iterable<BeanEntry> locate(com.google.inject.Key key)
Description copied from interface: BeanLocator
Finds bean implementations that match the given qualified binding Key.

Specified by:
locate in interface BeanLocator
Parameters:
key - The qualified key
Returns:
Sequence of bean entries that match the given key

watch

public void watch(com.google.inject.Key key,
                  Mediator mediator,
                  Object watcher)
Description copied from interface: BeanLocator
Tracks bean implementations that match the given qualified binding Key.
Uses the Mediator pattern to send events to an arbitrary watcher object.

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

add

public void add(com.google.inject.Injector injector,
                int rank)
Description copied from interface: MutableBeanLocator
Adds the given ranked Injector and distributes its Bindings. Marked as deprecated because most clients should not call this method; any injector that contains a binding to the BeanLocator is automatically added to that locator as part of the bootstrapping process.

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

remove

public void remove(com.google.inject.Injector injector)
Description copied from interface: MutableBeanLocator
Removes the given Injector and its Bindings.

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

add

public void add(BindingPublisher publisher,
                int rank)
Description copied from interface: BindingDistributor
Adds the given ranked BindingPublisher and distributes its Bindings.

Specified by:
add in interface BindingDistributor
Parameters:
publisher - The new publisher
rank - The assigned rank

remove

public void remove(BindingPublisher publisher)
Description copied from interface: BindingDistributor
Removes the given BindingPublisher and its Bindings.

Specified by:
remove in interface BindingDistributor
Parameters:
publisher - The old publisher

clear

public void clear()
Description copied from interface: BindingDistributor
Removes all known BindingPublishers and their Bindings.

Specified by:
clear in interface BindingDistributor


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