@Typed public abstract class ProjectStage extends Object implements Serializable
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:
New ProjectStages can be added 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 example:
package org.apache.deltaspike.test.core.api.projectstage;
public class TestProjectStages 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();
}
To activate those ProjectStages, you have to register the ProjectStageHolder class to get picked up via the ServiceLoader mechanism. Simply create a file
META-INF/services/org.apache.deltaspike.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.deltaspike.test.core.api.projectstage.TestProjectStages
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)) ...
Note: DeltaSpike will only find ProjectStageHolders which are accessible by this very class. If you
deploy the deltaspike-core jar to a shared EAR classloader, it will e.g. not be able to register ProjectStages
defined in a web application's WEB-INF/classes directory!
| Modifier and Type | Class and Description |
|---|---|
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
|
| Modifier and Type | Field and Description |
|---|---|
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 |
| Modifier | Constructor and Description |
|---|---|
protected |
ProjectStage()
The protected constructor will register the given ProjectStage via its name.
|
| Modifier and Type | Method and Description |
|---|---|
String |
toString() |
static ProjectStage |
valueOf(String projectStageClassName) |
static ProjectStage[] |
values()
Exposes all registered
ProjectStage implementations. |
public static final ProjectStage.UnitTest UnitTest
ProjectStagepublic static final ProjectStage.Development Development
ProjectStagepublic static final ProjectStage.SystemTest SystemTest
ProjectStagepublic static final ProjectStage.IntegrationTest IntegrationTest
ProjectStagepublic static final ProjectStage.Staging Staging
ProjectStagepublic static final ProjectStage.Production Production
ProjectStageprotected ProjectStage()
toString() method of the ProjectStage.public static ProjectStage valueOf(String projectStageClassName)
projectStageClassName - the name of the ProjectStagepublic static ProjectStage[] values()
ProjectStage implementations.Copyright © 2015 The Apache Software Foundation. All rights reserved.