Class StateTransition<T extends Serializable>

  • 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 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 SerializableStateTransition<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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object