summaryrefslogtreecommitdiff
path: root/qpid/gentools/templ.java/method/version/MethodBodyClass.vm
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/gentools/templ.java/method/version/MethodBodyClass.vm')
-rw-r--r--qpid/gentools/templ.java/method/version/MethodBodyClass.vm190
1 files changed, 190 insertions, 0 deletions
diff --git a/qpid/gentools/templ.java/method/version/MethodBodyClass.vm b/qpid/gentools/templ.java/method/version/MethodBodyClass.vm
new file mode 100644
index 0000000000..bb62438a65
--- /dev/null
+++ b/qpid/gentools/templ.java/method/version/MethodBodyClass.vm
@@ -0,0 +1,190 @@
+#macro( UpperCamel $name )
+#set( $name = "${name.substring(0,1).toUpperCase()}${name.substring(1)}" )
+#end
+#macro( toUpperCamel $name )${name.substring(0,1).toUpperCase()}${name.substring(1)}#end
+
+
+
+#set( $amqp_ClassName = $amqpClass.Name)
+#UpperCamel( $amqp_ClassName )
+#set( $amqp_MethodName = $amqpMethod.Name )
+#UpperCamel( $amqp_MethodName )
+#set( $javaClassName = "${amqp_ClassName}${amqp_MethodName}BodyImpl" )
+#set( $interfaceName = "${amqp_ClassName}${amqp_MethodName}Body" )
+#set( $amqpPackageName = "amqp_$version.getMajor()_$version.getMinor()" )
+
+#set( $filename = "${amqpPackageName}/${javaClassName}.java")
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by ${generator} - do not modify.
+ * Supported AMQP version:
+ * $version.getMajor()-$version.getMinor()
+ */
+
+#set( $clazz = $amqpClass.asSingleVersionClass( $version ) )
+#set( $method = $amqpMethod.asSingleVersionMethod( $version ) )
+
+package org.apache.qpid.framing.amqp_$version.getMajor()_$version.getMinor();
+
+import java.util.HashMap;
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.qpid.framing.*;
+
+public class ${javaClassName} extends AMQMethodBody_$version.getMajor()_$version.getMinor() implements $interfaceName
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(ByteBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ${javaClassName}(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = $clazz.ClassId;
+
+ public static int METHOD_ID = $method.MethodId;
+
+
+
+ // Fields declared in specification
+#foreach( $field in $method.ConsolidatedFields )
+ private final $field.NativeType _$field.getName(); // $field.UnderlyingFields
+#end
+
+
+ // Constructor
+
+ public ${javaClassName}(ByteBuffer buffer) throws AMQFrameDecodingException
+ {
+#foreach( $field in $method.ConsolidatedFields )
+ _$field.Name = read$field.getEncodingType()( buffer );
+#end
+ }
+
+ public ${javaClassName}(
+#foreach( $field in $method.FieldList )
+#if( $velocityCount == $method.getFieldList().size() )
+ $field.NativeType $field.Name
+#else
+ $field.NativeType $field.Name,
+#end
+#end)
+ {
+#set( $consolidatedFieldName = "" )
+#foreach( $field in $method.FieldList )
+#if( $method.isConsolidated( $field.Name ) )
+#if( !$method.getConsolidatedFieldName( $field.Name ).equals( $consolidatedFieldName ) )
+#if( !$consolidatedFieldName.equals("") )
+ _$consolidatedFieldName = $consolidatedFieldName; // 1
+#end
+#set( $consolidatedFieldName = $method.getConsolidatedFieldName( $field.Name ) )
+ byte $consolidatedFieldName = (byte)0;
+#end
+ if( $field.Name )
+ {
+ $consolidatedFieldName = (byte) (((int) $consolidatedFieldName) | (1 << $method.getPositionInBitField( $field.Name )));
+ }
+#if( $velocityCount == $method.getFieldList().size())
+ _$consolidatedFieldName = $consolidatedFieldName;
+#else
+
+#end
+#else
+#if( !$consolidatedFieldName.equals("") )
+ _$consolidatedFieldName = $consolidatedFieldName;
+#end
+#set( $consolidatedFieldName = "" )
+ _$field.Name = $field.Name;
+#end
+#end
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+#foreach( $field in $method.FieldList )
+ public final $field.NativeType get#toUpperCamel( ${field.Name} )()
+ {
+#if( $method.isConsolidated( $field.Name ) )
+ return (((int)(_$method.getConsolidatedFieldName( $field.Name ))) & ( 1 << $method.getPositionInBitField( $field.Name ))) != 0;
+#else
+ return _$field.Name;
+#end
+ }
+#end
+
+ protected int getBodySize()
+ {
+ int size = 0;
+#foreach( $field in $method.ConsolidatedFields )
+#if( $field.isFixedSize() )
+ size += $field.Size;
+#else
+ size += getSizeOf( _$field.Name );
+#end
+#end
+ return size;
+ }
+
+ public void writeMethodPayload(ByteBuffer buffer)
+ {
+#foreach( $field in $method.ConsolidatedFields )
+
+ write$field.getEncodingType()( buffer, _$field.Name );
+#end
+ }
+
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer("[$javaClassName: ");
+#foreach( $field in $method.FieldList )
+ buf.append( "$field.Name=" );
+ buf.append( get#toUpperCamel( $field.Name )() );
+#if( $velocityCount != $method.FieldList.size() )
+ buf.append( ", " );
+#end
+#end
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}