Silk DI 0.6


se.jbee.inject.bootstrap
Interface Bootstrapper

All Known Implementing Classes:
BootstrapperBundle

public interface Bootstrapper

The basic idea is to split the binding process into 2 steps: installing modules and do bindings in the installed modules. Thereby it is possible to keep track of the modules that should be installed before actually install them. This has two major benefits: 1. it is possible and intentional to declare installation of the same module as often as wanted or needed without actually installing them more then once. This allows to see other modules as needed dependencies or 'parent'-modules. 2. the installation can be the first step of the verification (in a unit-test). The binding can be omitted so that overall test of a configuration can be very fast.

Author:
Jan Bernitt (jan@jbee.se)

Nested Class Summary
static interface Bootstrapper.ModularBootstrapper<M>
           
 
Method Summary
 void install(Class<? extends Bundle> bundle)
           
<M extends Enum<M>>
void
install(Class<? extends ModularBundle<M>> bundle, Class<M> property)
           
<M extends Enum<M> & ModularBundle<M>>
void
install(M... modules)
           
 void install(Module module)
           
<T> void
install(PresetModule<T> module)
           
 void uninstall(Class<? extends Bundle> bundle)
          Uninstalling is very different from overriding.
<M extends Enum<M> & ModularBundle<M>>
void
uninstall(M... modules)
           
 

Method Detail

install

void install(Class<? extends Bundle> bundle)
Parameters:
bundle - the Bundle to expand further

uninstall

void uninstall(Class<? extends Bundle> bundle)
Uninstalling is very different from overriding. It allows to totally remove a well defined part from the consideration while a override complects the overridden and the overriding Bundle with each other and requires to considerer both in a complected form. To allow predictability uninstalling is a final decision. Further calls that install the very same Bundle will not re-install it! There is no need to uninstall a Module since uninstalling the Bundle that installed the module will effectively uninstall the module as well (as long as that module is not installed by another installed bundle too). Allowing to uninstall separate Modules would break the well defined borders of bundles and lead to the need to consider something close to overrides.


install

void install(Module module)
Parameters:
module - the Module to install (within the parent Bundle that is given implicit - the Bootstrapper.ModularBootstrapper keeps track of that)

install

<T> void install(PresetModule<T> module)
Type Parameters:
T - Type of the preset value passed to the module
Parameters:
module - the PresetModule to install (within the parent Bundle that is given implicitly - the Bootstrapper.ModularBootstrapper keeps track of that)

install

<M extends Enum<M> & ModularBundle<M>> void install(M... modules)
Parameters:
modules - The choices made to install.

uninstall

<M extends Enum<M> & ModularBundle<M>> void uninstall(M... modules)
Parameters:
modules - The choices made to uninstall again.

install

<M extends Enum<M>> void install(Class<? extends ModularBundle<M>> bundle,
                                 Class<M> property)
Parameters:
bundle - the Bundle to install
property - The property the installation is connected to.
See Also:
Options

Silk DI 0.6