From a8960649bcd365ef70a5de7812f5910222388a6d Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 19 Dec 2008 03:57:23 +0000 Subject: Tagging RC4 for M4 release git-svn-id: https://svn.apache.org/repos/asf/qpid/tags/M4@727913 13f79535-47bb-0310-9956-ffa450edef68 --- RC4/java/common/StructFactory.tpl | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 RC4/java/common/StructFactory.tpl (limited to 'RC4/java/common/StructFactory.tpl') 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); + } + } + +} -- cgit v1.2.1