- Direct Known Subclasses:
Base
,Base
,Boot
,Client
,Client
,Jose
,Ldap
,Lettuce
,Server
,Server
,Server
,Vertx
The Module base class.
Generated module classes inherit this class which provides base module lifecycle implementation.
The following describes module startup steps:
- Start the required Inverno modules included in the module.
- Create the module beans that weren't already created.
Dependencies between beans determine the order in which they are created, as a result a bean can be created before the enclosing module is actually started.
The following describes the module destroy steps:
- Destroy the module beans in the reverse creation order.
- Stop the required Inverno modules included in the module.
A module should always be built using a Module.ModuleBuilder
.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Interface representing the lifecycle of a bean in a module.protected static class
Aggregates single beans, collections of beans and arrays of beans.protected static interface
Module.BeanBuilder<T,
B extends Module.BeanBuilder<T, B>> A BeanBuilder is used within a module class to createModule.Bean
instances.protected static interface
A BeanBuilder for creating moduleModule.Bean
instances.protected static class
Module.ModuleBuilder<T extends Module>
The Module Builder base class.protected static class
Module.ModuleLinker<T extends Module>
The Module Linker base class.protected static @interface
Provides socket information to the Inverno compiler.protected static interface
A BeanBuilder for creating wrapperModule.Bean
instances. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns the name of the module.boolean
isActive()
Determines whether the module is active (ie. started).void
start()
Starts the module.void
stop()
Stops the module.protected <T> Module.Bean
<T> with
(Module.ModuleBeanBuilder<T, ?> beanBuilder) Creates a module bean with the specified bean builder and registers it in this module.protected <T extends Module>
Twith
(Module.ModuleLinker<T> moduleLinker) Creates a module with the specified module linker and register it in this module.protected <T> Module.Bean
<T> with
(Module.WrapperBeanBuilder<T, ?, ?> beanBuilder) Creates a wrapper bean with the specified bean builder and registers it in this module.
-
Constructor Details
-
Module
Creates a new Module with the specified name.
- Parameters:
moduleName
- the module name
-
-
Method Details
-
with
Creates a module with the specified module linker and register it in this module.
A module can only be registered once to exactly one module.
- Type Parameters:
T
- the type of the module to create- Parameters:
moduleLinker
- the module linker to use to create the module- Returns:
- the registered module
-
with
Creates a module bean with the specified bean builder and registers it in this module.
A bean can only be registered once to exactly one module.
- Type Parameters:
T
- the type of the bean- Parameters:
beanBuilder
- the bean builder to use to create the bean- Returns:
- the registered bean
-
with
Creates a wrapper bean with the specified bean builder and registers it in this module.
A bean can only be registered once to exactly one module.
- Type Parameters:
T
- the type of the bean- Parameters:
beanBuilder
- the bean builder to use to create the bean- Returns:
- the registered bean
-
getName
Returns the name of the module.
- Returns:
- the name of the module
-
isActive
public boolean isActive()Determines whether the module is active (ie. started).
- Returns:
- true if the module is active, false otherwise.
-
start
Starts the module.
It creates and wires the beans defined within the module and the required Inverno modules it includes, the bean dependency graph determines the order into which beans are created. When the module is stopped, beans are destroyed in the reverse order.
- Throws:
IllegalStateException
- if the module is active.
-
stop
public void stop()Stops the module.
This methods basically destroy the beans created during startup in the reverse order.
-