01: package biz.hammurapi.web.mda;
02:
03: import java.io.Writer;
04: import java.util.Map;
05:
06: import biz.hammurapi.util.Attributable;
07:
08: /**
09: * Output channel for templates. Channels form a hierarchy. Each channel can have multiple
10: * sub-channels (parts). Part can be either writer or channel, whichever was retrieved first.
11: * @author Pavel
12: */
13: public interface Channel extends Attributable {
14:
15: /**
16: * @return Part writer to output generated code
17: * @throws IllegalStateException If channel for this part has already been retrieved.
18: */
19: Writer getWriter(String partName) throws IllegalStateException;
20:
21: /**
22: * @param path Parts path.
23: * @return Writer by path
24: * @throws IllegalStateException If channel for the last path elementhas already been retrieved or
25: * if writer has been retrieve for one of non-last elements.
26: */
27: Writer getWriter(String[] path);
28:
29: /**
30: * @return Part sub-channel to output generated code
31: * @throws IllegalStateException If writer for this part has already been retrieved.
32: */
33: SubChannel getChannel(String partName) throws IllegalStateException;
34:
35: /**
36: * @param path Parts path.
37: * @return Channel by path
38: * @throws IllegalStateException If writer for one of path elements has already been retrieved.
39: */
40: SubChannel getChannel(String[] path);
41:
42: /**
43: * @return Map of parts.
44: */
45: Map getParts();
46: }
|