01: package test.check.command;
02:
03: /**
04: * Chain command - applies a chain of configure commands on a component.
05: *
06: * @author Kirill Grouchnikov
07: * @param <T>
08: * Component class.
09: */
10: public class ChainCommand<T> implements ConfigurationCommand<T> {
11: /**
12: * Command chain.
13: */
14: private ConfigurationCommand<T>[] commands;
15:
16: /**
17: * Creates the chain command.
18: *
19: * @param commands
20: * Command chain.
21: */
22: public ChainCommand(ConfigurationCommand<T>... commands) {
23: super ();
24: this .commands = commands;
25: }
26:
27: /*
28: * (non-Javadoc)
29: *
30: * @see test.check.ConfigurationCommand#invoke(java.lang.Object)
31: */
32: public void configure(T component) {
33: for (ConfigurationCommand<T> cmd : this.commands)
34: cmd.configure(component);
35: }
36: }
|