Pregunta

I just learnt about the State pattern . I would like to know where in core Java / JSF/Servlets code s can I see this pattern being implemented ? I want to see how the state transition is implemented and who plays the role of states and who plays the role of context there ?

¿Fue útil?

Solución

In JSF it can be lifecycle processing. Phase is a state with concrete states: ApplyRequestValuesPhase, InvokeApplicationPhase, ProcessValidationsPhase, RenderResponsePhase, RestoreViewPhase, UpdateModelValuesPhase. Context would be Lifecycle.

NOTE: This example is from Mojarra implementation of JSF.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top