Class DefaultObjectiveContext
- java.lang.Object
-
- org.onosproject.net.flowobjective.DefaultObjectiveContext
-
- All Implemented Interfaces:
ObjectiveContext
public class DefaultObjectiveContext extends Object implements ObjectiveContext
Implementation of objective context that delegates calls to provided consumers.
-
-
Constructor Summary
Constructors Constructor Description DefaultObjectiveContext(BiConsumer<Objective,ObjectiveError> onError)
Creates a new objective context using the given error consumer.DefaultObjectiveContext(Consumer<Objective> onSuccess)
Creates a new objective context using the given success consumer.DefaultObjectiveContext(Consumer<Objective> onSuccess, BiConsumer<Objective,ObjectiveError> onError)
Creates a new objective context using the given success and error consumers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onError(Objective objective, ObjectiveError error)
Invoked when error is encountered while executing the flow objective.void
onSuccess(Objective objective)
Invoked on successful execution of the flow objective.
-
-
-
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 successonError
- 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 interfaceObjectiveContext
- 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 interfaceObjectiveContext
- Parameters:
objective
- objective to executeerror
- error encountered
-
-