com.sun.jersey.guice.spi.container
Class GuiceComponentProviderFactory

java.lang.Object
  extended by com.sun.jersey.guice.spi.container.GuiceComponentProviderFactory
All Implemented Interfaces:
ComponentProviderFactory<IoCComponentProvider>, IoCComponentProviderFactory
Direct Known Subclasses:
GuiceContainer.ServletGuiceComponentProviderFactory

public class GuiceComponentProviderFactory
extends java.lang.Object
implements IoCComponentProviderFactory

The Guice-based IoCComponentProviderFactory.

Author:
Gili Tzabari, Paul Sandoz

Constructor Summary
GuiceComponentProviderFactory(ResourceConfig config, com.google.inject.Injector injector)
          Creates a new GuiceComponentProviderFactory.
 
Method Summary
 java.util.Map<com.google.inject.Scope,ComponentScope> createScopeMap()
          Maps a Guice scope to a Jersey scope.
 IoCComponentProvider getComponentProvider(java.lang.Class c)
          Get the IoC component provider for a class.
 IoCComponentProvider getComponentProvider(ComponentContext cc, java.lang.Class clazz)
          Get the IoC component provider for a class with additional context.
 boolean isImplicitGuiceComponent(java.lang.Class<?> c)
          Determine if a class is an implicit Guice component that can be instatiated by Guice and the life-cycle managed by Jersey.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiceComponentProviderFactory

public GuiceComponentProviderFactory(ResourceConfig config,
                                     com.google.inject.Injector injector)
Creates a new GuiceComponentProviderFactory.

Parameters:
config - the resource configuration
injector - the Guice injector
Method Detail

getComponentProvider

public IoCComponentProvider getComponentProvider(java.lang.Class c)
Description copied from interface: IoCComponentProviderFactory
Get the IoC component provider for a class.

Specified by:
getComponentProvider in interface ComponentProviderFactory<IoCComponentProvider>
Specified by:
getComponentProvider in interface IoCComponentProviderFactory
Parameters:
c - the class
Returns:
the IoC component provider for the class, otherwise null if the class is not supported.

getComponentProvider

public IoCComponentProvider getComponentProvider(ComponentContext cc,
                                                 java.lang.Class clazz)
Description copied from interface: IoCComponentProviderFactory
Get the IoC component provider for a class with additional context.

The additional context will be associated with the annotations and optionally an annotated object. For example, a component provider may be requested for a class that is the type of a Field, or be requested for a class that is the type of a method parameter.

Specified by:
getComponentProvider in interface IoCComponentProviderFactory
Parameters:
cc - the component context to obtain annotations and the annotated object (if present).
clazz - the class
Returns:
the IoC component provider for the class, otherwise null if the class is not supported.

isImplicitGuiceComponent

public boolean isImplicitGuiceComponent(java.lang.Class<?> c)
Determine if a class is an implicit Guice component that can be instatiated by Guice and the life-cycle managed by Jersey.

Parameters:
c - the class.
Returns:
true if the class is an implicit Guice component.

createScopeMap

public java.util.Map<com.google.inject.Scope,ComponentScope> createScopeMap()
Maps a Guice scope to a Jersey scope.

Returns:
the map


Copyright © 2011 Sun Microsystems, Inc. All Rights Reserved.