Package moxy.viewstate.strategy
Class SingleStateStrategy
- java.lang.Object
-
- moxy.viewstate.strategy.SingleStateStrategy
-
- All Implemented Interfaces:
StateStrategy
public class SingleStateStrategy extends java.lang.Object implements StateStrategy
This strategy will clear current commands queue and then the given command will be put in.Caution! Be sure that you fully set view to initial state inside this command.
-
-
Constructor Summary
Constructors Constructor Description SingleStateStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <View extends MvpView>
voidafterApply(java.util.List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand)Called immediately after a command was applied to anMvpView.<View extends MvpView>
voidbeforeApply(java.util.List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand)Called immediately afterMvpViewStatereceives some command.
-
-
-
Method Detail
-
beforeApply
public <View extends MvpView> void beforeApply(java.util.List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand)
Description copied from interface:StateStrategyCalled immediately afterMvpViewStatereceives some command. Will not be called before re-apply to some otherMvpView- Specified by:
beforeApplyin interfaceStateStrategy- Type Parameters:
View- type of the given view- Parameters:
currentState- current state ofMvpViewState. EachViewCommandcontains its own parameters.incomingCommand- command for applying to aMvpViewThisViewCommandcontains params of this command.
-
afterApply
public <View extends MvpView> void afterApply(java.util.List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand)
Description copied from interface:StateStrategyCalled immediately after a command was applied to anMvpView. Also called after re-apply to other views.- Specified by:
afterApplyin interfaceStateStrategy- Type Parameters:
View- type of the given view- Parameters:
currentState- current state ofMvpViewState. EachViewCommandcontains its own parameters.incomingCommand- applied command toMvpViewThisViewCommandcontains params of this command.
-
-