summaryrefslogtreecommitdiff
path: root/RC4/java/common/StructFactory.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'RC4/java/common/StructFactory.tpl')
-rw-r--r--RC4/java/common/StructFactory.tpl39
1 files changed, 39 insertions, 0 deletions
diff --git a/RC4/java/common/StructFactory.tpl b/RC4/java/common/StructFactory.tpl
new file mode 100644
index 0000000000..f3dcbbd68a
--- /dev/null
+++ b/RC4/java/common/StructFactory.tpl
@@ -0,0 +1,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);
+ }
+ }
+
+}