Class DefaultLifecycle<S extends State<S>>

    • Constructor Detail

      • DefaultLifecycle

        public DefaultLifecycle​(org.gcube.common.events.Hub hub,
                                String name,
                                S startState)
    • Method Detail

      • state

        public S state()
        Description copied from interface: Lifecycle
        Returns the current state of this lifecycle.
        Specified by:
        state in interface Lifecycle<S extends State<S>>
        Returns:
        the current state.
      • moveTo

        public void moveTo​(S next)
        Description copied from interface: Lifecycle
        Transition this lifecycle to a given state.
        Specified by:
        moveTo in interface Lifecycle<S extends State<S>>
        Parameters:
        next - the state
      • tryMoveTo

        public boolean tryMoveTo​(S next)
        Description copied from interface: Lifecycle
        Attempts to transition this lifecycle to a given state, but does not fail if the transition is illegal for this lifecycle.
        Specified by:
        tryMoveTo in interface Lifecycle<S extends State<S>>
        Parameters:
        next - the state
        Returns:
        true if this lifecycle has transitioned to the given state
      • previous

        public S previous()
        Description copied from interface: Lifecycle
        Returns the state from which this lifecycle transitioned to its current state.
        Specified by:
        previous in interface Lifecycle<S extends State<S>>
        Returns:
        the previous state