pt.digitalis.utils.ioc
Interface IIoCRegistry

All Known Implementing Classes:
AbstractIoCRegistryImpl, IoCRegistryGuiceImpl

public interface IIoCRegistry

Defines the expected behavior for the IoC services and contributions registry. All accesses to the registry will be made through this interface. Accessing the registry through this interface reduces the impact of changing the used IoC framework and user defined implementations.

Author:
Pedro Viegas pviegas@digitalis.pt, Rodrigo Gonçalves rgoncalves@digitalis.pt

Method Summary
<T> T
getImplementation(Class<T> serviceInterface)
          Returns the implementation of a given interface.
<T> T
getImplementation(Class<T> serviceInterface, String id)
          Returns the implementation of a given interface with a given identification.
<T> List<T>
getImplementations(Class<T> serviceInterface)
          Returns the list of implementations for the given interface.
<T> Map<String,T>
getImplementationsMap(Class<T> serviceInterface)
          Returns the list of implementations for the interface with the given ID.
 void injectDependencies(Object obj)
          Injects dependencies into an object.
 

Method Detail

getImplementation

<T> T getImplementation(Class<T> serviceInterface)
Returns the implementation of a given interface.

Type Parameters:
T - the service's class
Parameters:
serviceInterface - the service's interface type
Returns:
the instance for the service's implementation

getImplementation

<T> T getImplementation(Class<T> serviceInterface,
                        String id)
Returns the implementation of a given interface with a given identification.

Type Parameters:
T - the service's class
Parameters:
serviceInterface - the service's interface type
id - the implementation's id
Returns:
the instance for the service's implementation

getImplementationsMap

<T> Map<String,T> getImplementationsMap(Class<T> serviceInterface)
Returns the list of implementations for the interface with the given ID.

Type Parameters:
T - the service's class
Parameters:
serviceInterface - the service's interface type
Returns:
a Map with all instances for each implementation of the service as V and the corresponding ID as K

getImplementations

<T> List<T> getImplementations(Class<T> serviceInterface)
Returns the list of implementations for the given interface.

Type Parameters:
T - the service's class
Parameters:
serviceInterface - the service's interface type
Returns:
the list of instances for each service's implementation

injectDependencies

void injectDependencies(Object obj)
Injects dependencies into an object. Used to inject an implementation into an object not created through the IoC framework. Requires the object to be annotated with com.google.inject.Inject.

Parameters:
obj - the object to inject dependencies into
See Also:
Inject


Copyright © 2012 Digitalis Informática Lda. All Rights Reserved.