src/main/java/com/github/oxo42/stateless4j/StateConfiguration.java
public StateConfiguration<S, T> permitDynamicIf(T trigger, final Func<S> destinationStateSelector, FuncBoolean guard,
                                                    final Action action) {
        assert destinationStateSelector != null : DESTINATION_STATE_SELECTOR_IS_NULL;
        return publicPermitDynamicIf(trigger, new Func2<Object[], S>() {
            @Override
            public S call(Object[] arg0) {
                return destinationStateSelector.call();
            }
        }, guard, new Action1<Object[]>() {
            @SuppressWarnings("unchecked")
            @Override
            public void doIt(Object[] args) {
                action.doIt();
            }
        });
    }
public StateConfiguration<S, T> permitDynamicIf(T trigger, final Func<S> destinationStateSelector, FuncBoolean guard,
                                                    final Action action) {
        assert destinationStateSelector != null : DESTINATION_STATE_SELECTOR_IS_NULL;
        return publicPermitDynamicIf(trigger, new Func2<Object[], S>() {
            @Override
            public S call(Object[] arg0) {
                return destinationStateSelector.call();
            }
        }, guard, new Action1<Object[]>() {
            @SuppressWarnings("unchecked")
            @Override
            public void doIt(Object[] args) {
                action.doIt();
            }
        });
    }
public StateConfiguration < S , T > permitDynamicIf ( T trigger , final Func < S > destinationStateSelector , FuncBoolean guard , final Action action ) { assert destinationStateSelector != null : DESTINATION_STATE_SELECTOR_IS_NULL ; return publicPermitDynamicIf ( trigger , new Func2 < Object [ ] , S > ( ) { @ Override public S call ( Object [ ] arg0 ) { return destinationStateSelector . call ( ) ; } } , guard , new Action1 < Object [ ] > ( ) { @ SuppressWarnings ( "unchecked" ) @ Override public void doIt ( Object [ ] args ) { action . doIt ( ) ; } } ) ; }
Accept the specified trigger and transition to the destination state, calculated dynamically by the supplied
function
<p>
Additionally a given action is performed when transitioning. This action will be called after
the onExit action of the current state and before the onEntry action of the destination state.

@param trigger                  The accepted trigger
@param destinationStateSelector Function to calculate the state that the trigger will cause a transition to
@param guard                    Function that must return true in order for the  trigger to be accepted
@param action                   The action to be performed "during" transition
@return The receiver
Accept the specified trigger and transition to the destination state calculated dynamically by the supplied function <p > Additionally a given action is performed when transitioning . This action will be called after the onExit action of the current state and before the onEntry action of the destination state .