|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage
@Typed public abstract class ProjectStage
This class is the base of all ProjectStages. A ProjectStage identifies the environment the application currently runs in. It provides the same functionality as the JSF-2 ProjectStage but has a few additional benefits:
Technically this is kind of a 'dynamic enum'.
The following ProjectStages are provided by default
The following resolution mechanism is used to determine the current ProjectStage:
Adding a new ProjectStage is done via the
ServiceLoader
mechanism. A class deriving from ProjectStage
must be provided and used for creating a single static instance of it.
Custom ProjectStages can be implemented by writing anonymous ProjectStage
members into a registered ProjectStageHolder
as shown in the following
sample:
package org.apache.myfaces.extensions.cdi.test.api.projectstage; public class MyProjectStages implements ProjectStageHolder { public static final class MyOwnProjectStage extends ProjectStage {}; public static final MyOwnProjectStage MyOwnProjectStage = new MyOwnProjectStage(); public static final class MyOtherProjectStage extends ProjectStage {}; public static final MyOtherProjectStage MyOtherProjectStage = new MyOtherProjectStage(); }
For activating those projectstages, you have to register this ProjectStageHolder class to get picked up via the java.util.ServiceLoader mechanism. Simply create a file
META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolderwhich contains the fully qualified class name of custom ProjectStageHolder implementation:
# this class now gets picked up by java.util.ServiceLoader org.apache.myfaces.extensions.cdi.core.test.api.projectstage.MyProjectStages
You can use your own ProjectStages exactly the same way as all the ones provided by the system:
ProjectStage myOwnPs = ProjectStage.valueOf("MyOwnProjectStage"); if (myOwnPs.equals(MyOwnProjectStage.MyOwnProjectStage)) ...
Nested Class Summary | |
---|---|
static class |
ProjectStage.Development
Project-stage for development |
static class |
ProjectStage.IntegrationTest
Project-stage for integration-tests |
static class |
ProjectStage.Production
Default project-stage for production |
static class |
ProjectStage.Staging
Project-stage for staging |
static class |
ProjectStage.SystemTest
Project-stage for system-tests |
static class |
ProjectStage.UnitTest
Project-stage for unit-tests |
Field Summary | |
---|---|
static ProjectStage.Development |
Development
Type-safe ProjectStage |
static ProjectStage.IntegrationTest |
IntegrationTest
Type-safe ProjectStage |
static ProjectStage.Production |
Production
Type-safe ProjectStage |
static ProjectStage.Staging |
Staging
Type-safe ProjectStage |
static ProjectStage.SystemTest |
SystemTest
Type-safe ProjectStage |
static ProjectStage.UnitTest |
UnitTest
Type-safe ProjectStage |
Constructor Summary | |
---|---|
protected |
ProjectStage()
The protected constructor will register the given ProjectStage via its name. |
Method Summary | |
---|---|
String |
toString()
|
static ProjectStage |
valueOf(String projectStageClassName)
|
static ProjectStage[] |
values()
Exposes all registered ProjectStage implementations |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ProjectStage.UnitTest UnitTest
ProjectStage
public static final ProjectStage.Development Development
ProjectStage
public static final ProjectStage.SystemTest SystemTest
ProjectStage
public static final ProjectStage.IntegrationTest IntegrationTest
ProjectStage
public static final ProjectStage.Staging Staging
ProjectStage
public static final ProjectStage.Production Production
ProjectStage
Constructor Detail |
---|
protected ProjectStage()
toString()
method of the ProjectStage.
Method Detail |
---|
public static ProjectStage valueOf(String projectStageClassName)
projectStageClassName
- the name of the ProjectStage
public static ProjectStage[] values()
ProjectStage
implementations
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |