|
||||||||||
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 get's 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
|
static class |
ProjectStage.IntegrationTest
|
static class |
ProjectStage.Production
|
static class |
ProjectStage.Staging
|
static class |
ProjectStage.SystemTest
|
static class |
ProjectStage.UnitTest
|
Field Summary | |
---|---|
static ProjectStage.Development |
Development
|
static ProjectStage.IntegrationTest |
IntegrationTest
|
static ProjectStage.Production |
Production
|
static ProjectStage.Staging |
Staging
|
static ProjectStage.SystemTest |
SystemTest
|
static ProjectStage.UnitTest |
UnitTest
|
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()
|
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
public static final ProjectStage.Development Development
public static final ProjectStage.SystemTest SystemTest
public static final ProjectStage.IntegrationTest IntegrationTest
public static final ProjectStage.Staging Staging
public static final ProjectStage.Production Production
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()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |