summaryrefslogtreecommitdiff
path: root/java/common/StructFactory.tpl
blob: f3dcbbd68ad360d79c1052295755d8b269d64ab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.apache.qpid.transport;

class StructFactory {

    public static Struct create(int type)
    {
        switch (type)
        {
${
from genutil import *

fragment = """        case $name.TYPE:
            return new $name();
"""

for c in composites:
  name = cname(c)
  if c.name == "struct":
    out(fragment)
}        default:
            throw new IllegalArgumentException("type: " + type);
        }
    }

    public static Struct createInstruction(int type)
    {
        switch (type)
        {
${
for c in composites:
  name = cname(c)
  if c.name in ("command", "control"):
    out(fragment)
}        default:
            throw new IllegalArgumentException("type: " + type);
        }
    }

}