Class StateTransition<T extends Serializable>
- java.lang.Object
-
- org.silverpeas.core.notification.system.StateTransition<T>
-
- Type Parameters:
T
- the type representing a state in the state-machine.
- All Implemented Interfaces:
Serializable
public class StateTransition<T extends Serializable> extends Object implements Serializable
It is a generic representation of a transition between two states of a state-machine, whatever the state-machine is. Usually many of the resources managed or handled in Silverpeas are state-machine alike. All classes presenting a transition with business logic should extend this class and adds the treatment specific to the transition they represent.- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StateTransition(T beforeTransition, T afterTransition)
Constructs a new instance representing a transition between the two specified states.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
T
getAfter()
Gets the state after the transition occurred.T
getBefore()
Gets the state before the transition occurred.int
hashCode()
static <T extends Serializable>
StateTransition<T>transitionBetween(T beforeTransition, T afterTransition)
Constructs a new instance representing a transition between the two specified states.
-
-
-
Constructor Detail
-
StateTransition
public StateTransition(T beforeTransition, T afterTransition)
Constructs a new instance representing a transition between the two specified states.- Parameters:
beforeTransition
- the state before the transition is occurred.afterTransition
- the state after the transition is occurred.
-
-
Method Detail
-
transitionBetween
public static <T extends Serializable> StateTransition<T> transitionBetween(T beforeTransition, T afterTransition)
Constructs a new instance representing a transition between the two specified states.- Type Parameters:
T
- the serializable type of the state.- Parameters:
beforeTransition
- the state before the transition is occurred.afterTransition
- the state after the transition is occurred.- Returns:
- a new transition between two states of type T.
-
getBefore
public T getBefore()
Gets the state before the transition occurred.- Returns:
- the state before this transition.
-
getAfter
public T getAfter()
Gets the state after the transition occurred.- Returns:
- the state after this transition.
-
-