@ApplicationScoped public class ProjectStageProducer extends Object implements Serializable
Produces ProjectStage
configurations.
The producer will try to detect the currently active ProjectStage on startup and use that for all generated fields.
Usage:
Simply inject the current ProjectStage into any bean:public class MyBean { private @Inject ProjectStage projectStage; public void fn() { if(projectStage == ProjectStage.Production) { // do some production stuff... } } }
Please note that there can only be one ProjectStage per EAR.
Modifier and Type | Field and Description |
---|---|
static String[] |
CONFIG_SETTING_KEYS
These config keys will get used to detect the ProjectStage.
|
protected static Logger |
LOG |
Modifier | Constructor and Description |
---|---|
protected |
ProjectStageProducer()
ProjectStageProducers must only be created by subclassing producers
|
Modifier and Type | Method and Description |
---|---|
static ProjectStageProducer |
getInstance()
This factory method should only get used if there is absolutely no way
to get the current
ProjectStage via @Inject. |
ProjectStage |
getProjectStage()
We can only produce @Dependent scopes since an enum is final.
|
protected void |
initProjectStage() |
protected void |
reset()
Can be used esp.
|
protected ProjectStage |
resolveProjectStage()
Resolves the project-stage configured for DeltaSpike
|
static void |
setProjectStage(ProjectStage ps)
This function can be used to manually set the ProjectStage for the application.
|
public static final String[] CONFIG_SETTING_KEYS
protected static final Logger LOG
protected ProjectStageProducer()
@Produces @Dependent @Default public ProjectStage getProjectStage()
public static ProjectStageProducer getInstance()
This factory method should only get used if there is absolutely no way
to get the current ProjectStage
via @Inject.
protected ProjectStage resolveProjectStage()
ProjectStage
or null
if none defined.protected void initProjectStage()
protected void reset()
new ProjectStageProducer() { @Override protected void reset() { super.reset(); } }.reset();
public static void setProjectStage(ProjectStage ps)
ps
- the ProjectStage to setCopyright © 2015 The Apache Software Foundation. All rights reserved.