diff options
Diffstat (limited to 'java/common/StructFactory.tpl')
-rw-r--r-- | java/common/StructFactory.tpl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/java/common/StructFactory.tpl b/java/common/StructFactory.tpl new file mode 100644 index 0000000000..b27621b1d2 --- /dev/null +++ b/java/common/StructFactory.tpl @@ -0,0 +1,39 @@ +package org.apache.qpidity.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); + } + } + +} |