Created
May 10, 2010 18:00
-
-
Save agross/396322 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ICommandMessageHandler<TCommand> | |
{ | |
void Execute(TCommand message); | |
} | |
public interface ICommandMessageHandler : ICommandMessageHandler<object> | |
{ | |
} | |
public abstract class Command<T> : ICommandMessageHandler | |
{ | |
public void Execute(object message) | |
{ | |
Execute((T) message); | |
} | |
protected abstract void Execute(T message); | |
} | |
public interface IAmSynchronized : ICommandMessageHandler | |
{ | |
} | |
public class SynchronizedCommandDecorator : ICommandMessageHandler | |
{ | |
readonly IAmSynchronized _handler; | |
readonly ISynchronizer _synchronizer; | |
public SynchronizedCommandDecorator(IAmSynchronized handler, ISynchronizer synchronizer) | |
{ | |
_handler = handler; | |
_synchronizer = synchronizer; | |
} | |
public void Execute(object message) | |
{ | |
// call _handler | |
} | |
} | |
public class ConfigureEnvironmentCommand : Command<ConfigureEnvironmentMessage> | |
{ | |
protected override void Execute(ConfigureEnvironmentMessage message) | |
{ | |
} | |
} | |
public class ConfigureEnvironmentMessage | |
{ | |
} | |
public class ConfigureEnvironmentCommandSync : Command<ConfigureEnvironmentMessage>, IAmSynchronized | |
{ | |
protected override void Execute(ConfigureEnvironmentMessage message) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment