summaryrefslogtreecommitdiff
path: root/java/common/Composite.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'java/common/Composite.tpl')
-rw-r--r--java/common/Composite.tpl53
1 files changed, 50 insertions, 3 deletions
diff --git a/java/common/Composite.tpl b/java/common/Composite.tpl
index 37e3bf8853..283fa24641 100644
--- a/java/common/Composite.tpl
+++ b/java/common/Composite.tpl
@@ -1,5 +1,6 @@
package org.apache.qpid.transport;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -9,7 +10,6 @@ import java.util.UUID;
import org.apache.qpid.transport.codec.Decoder;
import org.apache.qpid.transport.codec.Encodable;
import org.apache.qpid.transport.codec.Encoder;
-import org.apache.qpid.transport.codec.Validator;
import org.apache.qpid.transport.network.Frame;
@@ -18,11 +18,13 @@ from genutil import *
cls = klass(type)["@name"]
+segments = type["segments"]
+
if type.name in ("control", "command"):
base = "Method"
size = 0
pack = 2
- if type["segments"]:
+ if segments:
payload = "true"
else:
payload = "false"
@@ -86,6 +88,10 @@ options = get_options(fields)
for f in fields:
if not f.empty:
out(" private $(f.type) $(f.name);\n")
+
+if segments:
+ out(" private Header header;\n")
+ out(" private ByteBuffer body;\n")
}
${
@@ -99,6 +105,10 @@ for f in fields:
if f.option: continue
out(" $(f.set)($(f.name));\n")
+if segments:
+ out(" setHeader(header);\n")
+ out(" setBody(body);\n")
+
if options or base == "Method":
out("""
for (int i=0; i < _options.length; i++) {
@@ -154,7 +164,6 @@ else:
}
public final $name $(f.set)($(f.type) value) {
- $(f.check)
${
if not f.empty:
out(" this.$(f.name) = value;")
@@ -173,6 +182,44 @@ if pack > 0:
""")
}
+${
+if segments:
+ out(""" public final Header getHeader() {
+ return this.header;
+ }
+
+ public final void setHeader(Header header) {
+ this.header = header;
+ }
+
+ public final $name header(Header header) {
+ setHeader(header);
+ return this;
+ }
+
+ public final ByteBuffer getBody() {
+ if (this.body == null)
+ {
+ return null;
+ }
+ else
+ {
+ return this.body.slice();
+ }
+ }
+
+ public final void setBody(ByteBuffer body) {
+ this.body = body;
+ }
+
+ public final $name body(ByteBuffer body)
+ {
+ setBody(body);
+ return this;
+ }
+""")
+}
+
public void write(Encoder enc)
{
${