I am wondering how I could implement a "jump behavior" in the main chain. The use case for a "jump behavior" is that the main chain should continue with several commands skipped over. For example, I would like to jump to the last command in the main chain after the current command. Any ideas?
As a general concept, "jumping" smells wrong to me. The commands should handle or not handle whatever is passed to them, as each individual Command sees fit. When context dictates, the commands should be able to "skip themselves". The chain shouldn't be cast as a controller.
I suppose you could use the Context as a psuedo-controller. For example, it could have an attribute that told these Commands that they should be skip themselves. (If ([whatever]) return false;)
Though, for skipping to a final Command, would a Filter work for you? I haven't started using them yet (though I may today), but I understand the idea is that once a Command returns true, it skips to a postprocess method (even if an exception is thrown). The Javadoc mentions reclaiming resources, but it could be to do anything that might need to be done when a Chain completes. Even call itself to trigger some behavior now that the Context has reached a certain state.
Either the Command that would trigger the "jump" could be a Filter, or the Filter Command could be executed early in the chain (and just return false).
-Ted.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]