info.magnolia.objectfactory.guice
Class GuiceComponentProvider

java.lang.Object
  extended by info.magnolia.objectfactory.guice.GuiceComponentProvider
All Implemented Interfaces:
ComponentProvider

public class GuiceComponentProvider
extends Object
implements ComponentProvider

ComponentProvider implementation based on Guice.

Version:
$Id$
See Also:
ComponentProvider, GuiceComponentProviderBuilder

Constructor Summary
GuiceComponentProvider(Map<Class<?>,Class<?>> typeMappings, GuiceComponentProvider parentComponentProvider)
           
 
Method Summary
 void destroy()
           
<T> T
getComponent(Class<T> type)
          Returns the component mapped for a given type.
<T> Class<? extends T>
getImplementation(Class<T> type)
          Returns the implementation type mapped for a given type.
 com.google.inject.Injector getInjector()
           
 GuiceComponentProvider getParent()
           
<T> javax.inject.Provider<T>
getProvider(Class<T> type)
           
<T> T
getSingleton(Class<T> type)
          Deprecated. 
 void injectMembers(Object instance)
           
<T> T
newInstance(Class<T> type, Object... parameters)
          Creates a new instance of the passed interface / class by using the registered implementation.
<T> T
newInstanceWithParameterResolvers(Class<T> type, ParameterResolver... parameterResolvers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiceComponentProvider

public GuiceComponentProvider(Map<Class<?>,Class<?>> typeMappings,
                              GuiceComponentProvider parentComponentProvider)
Method Detail

getImplementation

public <T> Class<? extends T> getImplementation(Class<T> type)
Description copied from interface: ComponentProvider
Returns the implementation type mapped for a given type. This is primarily used by Content2Bean.

Specified by:
getImplementation in interface ComponentProvider

getSingleton

@Deprecated
public <T> T getSingleton(Class<T> type)
Deprecated. 

Description copied from interface: ComponentProvider
Returns the component mapped for a given type.

Specified by:
getSingleton in interface ComponentProvider
See Also:
ComponentProvider.getComponent(Class)

getComponent

public <T> T getComponent(Class<T> type)
               throws NoSuchComponentException
Description copied from interface: ComponentProvider
Returns the component mapped for a given type.

Specified by:
getComponent in interface ComponentProvider
Returns:
the component that is mapped for this type or null if there is none
Throws:
NoSuchComponentException - in case the component wasn't found

newInstance

public <T> T newInstance(Class<T> type,
                         Object... parameters)
Description copied from interface: ComponentProvider
Creates a new instance of the passed interface / class by using the registered implementation. The parameters are used to build the object. Most likely they are passed to the constructor. If this fails a MgnlInstantiationException is thrown.

Specified by:
newInstance in interface ComponentProvider

newInstanceWithParameterResolvers

public <T> T newInstanceWithParameterResolvers(Class<T> type,
                                               ParameterResolver... parameterResolvers)
Specified by:
newInstanceWithParameterResolvers in interface ComponentProvider

getInjector

public com.google.inject.Injector getInjector()

getProvider

public <T> javax.inject.Provider<T> getProvider(Class<T> type)

injectMembers

public void injectMembers(Object instance)

destroy

public void destroy()

getParent

public GuiceComponentProvider getParent()
Specified by:
getParent in interface ComponentProvider


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.