pt.digitalis.utils.ioc.modules
Class IoCBindingManager

java.lang.Object
  extended by pt.digitalis.utils.ioc.modules.IoCBindingManager

public class IoCBindingManager
extends Object

Manages the IoC bindings.

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

Nested Class Summary
protected static class IoCBindingManager.BindingValitationResultAction
          Use to inform the BindingManager process of the action to perform for the validated binding
 
Method Summary
 void addBinding(IoCBinding binding)
          Adds a new binding to the manager.
 void addModuleBindings(IIoCModule module)
          Adds all bindings of the given module.
 IoCBinding getBinding(Class<?> interfaceType)
          Returns the first available implementation for the given interface type.
 IoCBinding getBinding(Class<?> interfaceType, String id)
          Returns the implementation with a given id for the given interface type.
 Map<Class<?>,List<IoCBinding>> getBindings()
          Returns all the available bindings.
 List<IoCBinding> getBindings(Class<?> interfaceType)
          Returns all the available bindings for a given interface.
static IoCBindingManager getInstance()
          Singleton instance accessor.
 void processDynamicMudules()
          After all modules are initialized the dynamic modules should be processed
protected  void resetBindings()
          Clears all existing bindings.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static IoCBindingManager getInstance()
Singleton instance accessor.

Returns:
the instance

addBinding

public void addBinding(IoCBinding binding)
Adds a new binding to the manager. responsible for all logic behind the binding process.

Parameters:
binding - the binding to add

addModuleBindings

public void addModuleBindings(IIoCModule module)
Adds all bindings of the given module.

Parameters:
module - the IoC module

getBinding

public IoCBinding getBinding(Class<?> interfaceType)
Returns the first available implementation for the given interface type.

Parameters:
interfaceType - the interface type for which the implementation is requested
Returns:
the first available implementation for the given interface type

getBinding

public IoCBinding getBinding(Class<?> interfaceType,
                             String id)
Returns the implementation with a given id for the given interface type.

Parameters:
interfaceType - the interface type for which the implementation is requested.
id - the implementation id
Returns:
the implementations with the given id

getBindings

public Map<Class<?>,List<IoCBinding>> getBindings()
Returns all the available bindings.

Returns:
all the available bindings

getBindings

public List<IoCBinding> getBindings(Class<?> interfaceType)
Returns all the available bindings for a given interface.

Parameters:
interfaceType - the interface type for which the implementations are requested.
Returns:
the list of available implementations for the given interface type

processDynamicMudules

public void processDynamicMudules()
After all modules are initialized the dynamic modules should be processed


resetBindings

protected void resetBindings()
Clears all existing bindings. Use for test purposes only!


toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


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