Class DefaultObjectiveContext

  • All Implemented Interfaces:
    ObjectiveContext

    public class DefaultObjectiveContext
    extends Object
    implements ObjectiveContext
    Implementation of objective context that delegates calls to provided consumers.
    • Constructor Detail

      • DefaultObjectiveContext

        public DefaultObjectiveContext​(Consumer<Objective> onSuccess,
                                       BiConsumer<Objective,​ObjectiveError> onError)
        Creates a new objective context using the given success and error consumers.
        Parameters:
        onSuccess - consumer to be called on success
        onError - consumer to be called on error
      • DefaultObjectiveContext

        public DefaultObjectiveContext​(Consumer<Objective> onSuccess)
        Creates a new objective context using the given success consumer.
        Parameters:
        onSuccess - consumer to be called on success
      • DefaultObjectiveContext

        public DefaultObjectiveContext​(BiConsumer<Objective,​ObjectiveError> onError)
        Creates a new objective context using the given error consumer.
        Parameters:
        onError - consumer to be called on error
    • Method Detail

      • onSuccess

        public void onSuccess​(Objective objective)
        Description copied from interface: ObjectiveContext
        Invoked on successful execution of the flow objective.
        Specified by:
        onSuccess in interface ObjectiveContext
        Parameters:
        objective - objective to execute
      • onError

        public void onError​(Objective objective,
                            ObjectiveError error)
        Description copied from interface: ObjectiveContext
        Invoked when error is encountered while executing the flow objective.
        Specified by:
        onError in interface ObjectiveContext
        Parameters:
        objective - objective to execute
        error - error encountered