|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.extensions.cdi.core.impl.projectstage.ProjectStageProducer
@ApplicationScoped public class ProjectStageProducer
Produces ProjectStage
configurations.
The producer will try to detect the currently active ProjectStage on startup and use that for all generated fields.
In case a JSF runtime is not available (e.g. in unit tests) we do all the determining ourself (but in the same way as MyFaces does it!)
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 prodution stuff... } } }
Field Summary | |
---|---|
protected static Logger |
LOG
|
Constructor Summary | |
---|---|
protected |
ProjectStageProducer()
ProjectStageProducers must only be created by subclassing producers |
Method Summary | |
---|---|
static ProjectStageProducer |
getInstance()
This factory method should only get used if there is absolutly 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()
|
protected ProjectStage |
resolveProjectStage()
Resolves the project-stage configured for codi For more information see MYFACES-2545 |
static void |
setProjectStage(ProjectStage ps)
This function can be used to manually set the ProjectStage for the application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger LOG
Constructor Detail |
---|
protected ProjectStageProducer()
Method Detail |
---|
@Produces @Dependent @Default public ProjectStage getProjectStage()
protected void reset()
public static ProjectStageProducer getInstance()
This factory method should only get used if there is absolutly no way
to get the current ProjectStage
via @Inject.
public static void setProjectStage(ProjectStage ps)
ps
- the ProjectStage to setprotected ProjectStage resolveProjectStage()
ProjectStage
or null
if none defined.protected void initProjectStage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |