Overview
Other MyFaces Extensions
- ExtVal
- Ext-Script
- [Orchestra]
- [Portlet Bridge]
Community
Development
Sponsorship
Your browser does not support iframes
...
The core provides a pluggable and type-safe approach for using project stages in a project (it's also used within the framework). Furthermore, @ProjectStageActivated
allows to use e.g. implementations annotated with javax.enterprise.inject.Alternative
for specific project-stages. Besides the out-of-This annotation allows to activate beans for a special project-stage. It's possible to use one of the out-of-the-box project-stages or a custom typesafe project-stageit's possible to implement custom but type-safe project-stages which will be exposed by CODI.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Alternative@Inject @ProjectStageActivated(ProjectStage.UnitTest.class) public class TestServiceMockImpl implements Service { private ProjectStage projectStage; //... } boolean isDevProjectStage = ProjectStage.Development.equals(this.projectStage); |
This annotation allows to activate beans for a special project-stage. It's possible to use one of the out-of-the-box project-stages or a custom typesafe project-stage.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Alternative
@ProjectStageActivated(ProjectStage.UnitTest.class)
public class TestServiceMockImpl implements Service
{
//...
}
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Alternative @ProjectStageActivated({ProjectStage.UnitTest.class, ProjectStage.Development.class}) public class DevServiceMockImpl implements Service { //... } |
...
However, with a custom ConfiguredValueResolver
it's possible to resolve configured values from any kind of configuration-source.
To avoid external dependencies, CODI uses the JDK Logger. However, CDI often requires serializable beans - therefore CODI provides a serializable wrapper for the JDK Logger.
...
public class MyBean
{
@Inject
private Logger logger;
}
By default the fully qualified class name of the target class which uses the injected logger, will be used to create the logger. As an alternative it's possible to use the LoggerDetails
qualifier to provide e.g. a name for the loggerresolve configured values from any kind of configuration-source.
To avoid external dependencies, CODI uses the JDK Logger. However, CDI often requires serializable beans - therefore CODI provides a serializable wrapper for the JDK Logger.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public class MyBean { @Inject @LoggerDetails(name = "AppLogger") class MyBean { @Inject private Logger logger; } |
The core provides a pluggable and type-safe approach for using project stages in a project (it's also used within the framework). Furthermore, @ProjectStageActivated
allows to use e.g. implementations annotated with javax.enterprise.inject.Alternative
for specific project-stages. Besides the out-of-the-box project-stages it's possible to implement custom but type-safe project-stages which will be exposed by CODIBy default the fully qualified class name of the target class which uses the injected logger, will be used to create the logger. As an alternative it's possible to use the LoggerDetails
qualifier to provide e.g. a name for the logger.
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
public class MyBean { @Inject @LoggerDetails(name = "AppLogger") private Logger logger; } @Inject private ProjectStage projectStage; //... boolean isDevProjectStage = ProjectStage.Development.equals(this.projectStage); |
...