org.jboss.guice.spi
Class GuiceIntegration

java.lang.Object
  extended by org.jboss.guice.spi.BinderHolder
      extended by org.jboss.guice.spi.GuiceIntegration
Direct Known Subclasses:
GuiceBinder, GuiceListener

public abstract class GuiceIntegration
extends BinderHolder

Microcontainer + Guice integration.

Author:
Ales Justin

Constructor Summary
protected GuiceIntegration(Kernel kernel, com.google.inject.Binder binder)
           
 
Method Summary
static void bindAll(com.google.inject.Binder binder, Controller controller)
          Binds all Microcontainer beans from the given factory by name.
static void bindAll(com.google.inject.Binder binder, Controller controller, ControllerContextBindFilter filter)
          Binds all Microcontainer beans from the given factory by name.
protected static void bindContext(com.google.inject.Binder binder, Controller controller, ControllerContext context)
          Bind controller context.
static
<T> com.google.inject.Provider<T>
fromMicrocontainer(Class<T> type)
          Creates a provider which looks up objects from Microcontainer using the given type.
static
<T> com.google.inject.Provider<T>
fromMicrocontainer(Class<T> type, Object name)
          Creates a provider which looks up objects from Microcontainer using the given name.
protected  KernelController getController()
          Get the kernel controller.
 
Methods inherited from class org.jboss.guice.spi.BinderHolder
getBinder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiceIntegration

protected GuiceIntegration(Kernel kernel,
                           com.google.inject.Binder binder)
Method Detail

getController

protected KernelController getController()
Get the kernel controller.

Returns:
the kernel controller

fromMicrocontainer

public static <T> com.google.inject.Provider<T> fromMicrocontainer(Class<T> type,
                                                                   Object name)
Creates a provider which looks up objects from Microcontainer using the given name. Expects a binding to Controller. Example usage:

 bind(DataSource.class).toProvider(fromMicrocontainer(DataSource.class, "dataSource"));
 

Type Parameters:
T - the class type
Parameters:
type - the class type
name - the bean name
Returns:
Provider instance

fromMicrocontainer

public static <T> com.google.inject.Provider<T> fromMicrocontainer(Class<T> type)
Creates a provider which looks up objects from Microcontainer using the given type. Expects a binding to Controller. Example usage:

 bind(DataSource.class).toProvider(fromMicrocontainer(DataSource.class));
 

Type Parameters:
T - the class type
Parameters:
type - the class type
Returns:
Provider instance

bindAll

public static void bindAll(com.google.inject.Binder binder,
                           Controller controller)
Binds all Microcontainer beans from the given factory by name. For a MC bean named "foo", this method creates a binding to the bean's type and @Named("foo").

Parameters:
binder - the binder
controller - the controller
See Also:
Named, Names.named(String)

bindAll

public static void bindAll(com.google.inject.Binder binder,
                           Controller controller,
                           ControllerContextBindFilter filter)
Binds all Microcontainer beans from the given factory by name. For a MC bean named "foo", this method creates a binding to the bean's type and @Named("foo").

Parameters:
binder - the binder
controller - the controller
filter - the filter
See Also:
Named, Names.named(String)

bindContext

protected static void bindContext(com.google.inject.Binder binder,
                                  Controller controller,
                                  ControllerContext context)
Bind controller context.

Parameters:
binder - the binder
controller - the controller
context - the context


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.