qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1773584 [4/4] - in /qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0: ./ codec/ framing/ messaging/ type/ type/codec/ type/messaging/codec/ type/security/codec/ type/transaction/codec/ typ...
Date Sun, 11 Dec 2016 16:01:07 GMT
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,69 +33,38 @@ import org.apache.qpid.server.protocol.v
 
 public class CoordinatorWriter extends AbstractDescribedTypeWriter<Coordinator>
 {
-    private Coordinator _value;
-    private int _count = -1;
-
-    public CoordinatorWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final Coordinator value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getCapabilities() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x30);
 
 
-    protected Object getDescriptor()
+    private CoordinatorWriter(final Registry registry, final Coordinator object)
     {
-        return UnsignedLong.valueOf(0x0000000000000030L);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
+    private static class Writer extends AbstractListWriter<Coordinator>
     {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+        private final Coordinator _value;
+        private final int _count;
 
-    private class Writer extends AbstractListWriter<Coordinator>
-    {
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final Coordinator object)
         {
             super(registry);
+
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final Coordinator value)
+        private int calculateCount()
         {
-            reset();
-        }
+            if( _value.getCapabilities() != null)
+            {
+                return 1;
+            }
 
+            return 0;
+        }
         @Override
         protected int getCount()
         {
@@ -122,11 +92,6 @@ public class CoordinatorWriter extends A
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +101,10 @@ public class CoordinatorWriter extends A
     private static Factory<Coordinator> FACTORY = new Factory<Coordinator>()
     {
 
-        public ValueWriter<Coordinator> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Coordinator> newInstance(final Registry registry, final Coordinator object)
         {
-            return new CoordinatorWriter(registry);
+            return new CoordinatorWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,67 +33,35 @@ import org.apache.qpid.server.protocol.v
 
 public class DeclareWriter extends AbstractDescribedTypeWriter<Declare>
 {
-    private Declare _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x31);
 
-    public DeclareWriter(final Registry registry)
+    private DeclareWriter(final Registry registry, final Declare object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Declare value)
+    private static class Writer extends AbstractListWriter<Declare>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
+        private final Declare _value;
+        private final int _count;
 
-        if( _value.getGlobalId() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000031L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<Declare>
-    {
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final Declare object)
         {
             super(registry);
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final Declare value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getGlobalId() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -122,11 +91,6 @@ public class DeclareWriter extends Abstr
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +100,10 @@ public class DeclareWriter extends Abstr
     private static Factory<Declare> FACTORY = new Factory<Declare>()
     {
 
-        public ValueWriter<Declare> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Declare> newInstance(final Registry registry, final Declare object)
         {
-            return new DeclareWriter(registry);
+            return new DeclareWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,67 +33,37 @@ import org.apache.qpid.server.protocol.v
 
 public class DeclaredWriter extends AbstractDescribedTypeWriter<Declared>
 {
-    private Declared _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x33);
 
-    public DeclaredWriter(final Registry registry)
-    {
-        super(registry);
-    }
 
-    @Override
-    protected void onSetValue(final Declared value)
+    private DeclaredWriter(final Registry registry, final Declared object)
     {
-        _value = value;
-        _count = calculateCount();
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Declared>
     {
+        private final Declared _value;
+        private final int _count;
 
-
-        if( _value.getTxnId() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000033L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<Declared>
-    {
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final Declared object)
         {
             super(registry);
+            _value = object;
+            _count = calculateCount();
+
         }
 
-        @Override
-        protected void onSetValue(final Declared value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getTxnId() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -122,11 +93,6 @@ public class DeclaredWriter extends Abst
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +102,10 @@ public class DeclaredWriter extends Abst
     private static Factory<Declared> FACTORY = new Factory<Declared>()
     {
 
-        public ValueWriter<Declared> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Declared> newInstance(final Registry registry, final Declared object)
         {
-            return new DeclaredWriter(registry);
+            return new DeclaredWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,72 +33,41 @@ import org.apache.qpid.server.protocol.v
 
 public class DischargeWriter extends AbstractDescribedTypeWriter<Discharge>
 {
-    private Discharge _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x32);
 
-    public DischargeWriter(final Registry registry)
+    private DischargeWriter(final Registry registry, final Discharge object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Discharge value)
+    private static class Writer extends AbstractListWriter<Discharge>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getFail() != null)
-        {
-            return 2;
-        }
-
-        if( _value.getTxnId() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000032L);
-    }
+        private Discharge _value;
+        private int _count = -1;
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<Discharge>
-    {
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final Discharge object)
         {
             super(registry);
+
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final Discharge value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getFail() != null)
+            {
+                return 2;
+            }
+
+            if( _value.getTxnId() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -130,11 +100,6 @@ public class DischargeWriter extends Abs
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -144,9 +109,10 @@ public class DischargeWriter extends Abs
     private static Factory<Discharge> FACTORY = new Factory<Discharge>()
     {
 
-        public ValueWriter<Discharge> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Discharge> newInstance(final Registry registry, final Discharge object)
         {
-            return new DischargeWriter(registry);
+            return new DischargeWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java Sun Dec 11 16:01:06 2016
@@ -1,4 +1,3 @@
-
 /*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
@@ -20,11 +19,11 @@
 *
 */
 
-
 package org.apache.qpid.server.protocol.v1_0.type.transaction.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,72 +31,41 @@ import org.apache.qpid.server.protocol.v
 
 public class TransactionalStateWriter extends AbstractDescribedTypeWriter<TransactionalState>
 {
-    private TransactionalState _value;
-    private int _count = -1;
-
-    public TransactionalStateWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final TransactionalState value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getOutcome() != null)
-        {
-            return 2;
-        }
-
-        if( _value.getTxnId() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x34);
 
-    @Override
-    protected void clear()
+    private TransactionalStateWriter(final Registry registry, final TransactionalState object)
     {
-        _value = null;
-        _count = -1;
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-
-    protected Object getDescriptor()
+    private static class Writer extends AbstractListWriter<TransactionalState>
     {
-        return UnsignedLong.valueOf(0x0000000000000034L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+        private final TransactionalState _value;
+        private final int _count;
 
-    private class Writer extends AbstractListWriter<TransactionalState>
-    {
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final TransactionalState object)
         {
             super(registry);
+
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final TransactionalState value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getOutcome() != null)
+            {
+                return 2;
+            }
+
+            if( _value.getTxnId() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -130,11 +98,6 @@ public class TransactionalStateWriter ex
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -144,9 +107,10 @@ public class TransactionalStateWriter ex
     private static Factory<TransactionalState> FACTORY = new Factory<TransactionalState>()
     {
 
-        public ValueWriter<TransactionalState> newInstance(Registry registry)
+        @Override
+        public ValueWriter<TransactionalState> newInstance(final Registry registry, final TransactionalState object)
         {
-            return new TransactionalStateWriter(registry);
+            return new TransactionalStateWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,133 +33,102 @@ import org.apache.qpid.server.protocol.v
 
 public class AttachWriter extends AbstractDescribedTypeWriter<Attach>
 {
-    private Attach _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x12);
 
-    public AttachWriter(final Registry registry)
+    private AttachWriter(final Registry registry, final Attach object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Attach value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Attach>
     {
+        private final Attach _value;
+        private final int _count;
 
+        private int _field;
 
-        if( _value.getProperties() != null)
-        {
-            return 14;
-        }
-
-        if( _value.getDesiredCapabilities() != null)
-        {
-            return 13;
-        }
-
-        if( _value.getOfferedCapabilities() != null)
-        {
-            return 12;
-        }
-
-        if( _value.getMaxMessageSize() != null)
-        {
-            return 11;
-        }
-
-        if( _value.getInitialDeliveryCount() != null)
-        {
-            return 10;
-        }
-
-        if( _value.getIncompleteUnsettled() != null)
+        public Writer(final Registry registry, final Attach object)
         {
-            return 9;
+            super(registry);
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getUnsettled() != null)
+        private int calculateCount()
         {
-            return 8;
-        }
+            if( _value.getProperties() != null)
+            {
+                return 14;
+            }
 
-        if( _value.getTarget() != null)
-        {
-            return 7;
-        }
+            if( _value.getDesiredCapabilities() != null)
+            {
+                return 13;
+            }
 
-        if( _value.getSource() != null)
-        {
-            return 6;
-        }
+            if( _value.getOfferedCapabilities() != null)
+            {
+                return 12;
+            }
 
-        if( _value.getRcvSettleMode() != null)
-        {
-            return 5;
-        }
+            if( _value.getMaxMessageSize() != null)
+            {
+                return 11;
+            }
 
-        if( _value.getSndSettleMode() != null)
-        {
-            return 4;
-        }
+            if( _value.getInitialDeliveryCount() != null)
+            {
+                return 10;
+            }
 
-        if( _value.getRole() != null)
-        {
-            return 3;
-        }
+            if( _value.getIncompleteUnsettled() != null)
+            {
+                return 9;
+            }
 
-        if( _value.getHandle() != null)
-        {
-            return 2;
-        }
+            if( _value.getUnsettled() != null)
+            {
+                return 8;
+            }
 
-        if( _value.getName() != null)
-        {
-            return 1;
-        }
+            if( _value.getTarget() != null)
+            {
+                return 7;
+            }
 
-        return 0;
-    }
+            if( _value.getSource() != null)
+            {
+                return 6;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getRcvSettleMode() != null)
+            {
+                return 5;
+            }
 
+            if( _value.getSndSettleMode() != null)
+            {
+                return 4;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000012L);
-    }
+            if( _value.getRole() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getHandle() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Attach>
-    {
-        private int _field;
+            if( _value.getName() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Attach value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -226,11 +196,6 @@ public class AttachWriter extends Abstra
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -240,9 +205,10 @@ public class AttachWriter extends Abstra
     private static Factory<Attach> FACTORY = new Factory<Attach>()
     {
 
-        public ValueWriter<Attach> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Attach> newInstance(final Registry registry, final Attach object)
         {
-            return new AttachWriter(registry);
+            return new AttachWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,103 +33,75 @@ import org.apache.qpid.server.protocol.v
 
 public class BeginWriter extends AbstractDescribedTypeWriter<Begin>
 {
-    private Begin _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x11);
 
-    public BeginWriter(final Registry registry)
+    private BeginWriter(final Registry registry, Begin object)
     {
-        super(registry);
+         super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Begin value)
+    private static class Writer extends AbstractListWriter<Begin>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getProperties() != null)
-        {
-            return 8;
-        }
+        private final Begin _value;
+        private final int _count;
 
-        if( _value.getDesiredCapabilities() != null)
-        {
-            return 7;
-        }
+        private int _field;
 
-        if( _value.getOfferedCapabilities() != null)
+        public Writer(final Registry registry, final Begin object)
         {
-            return 6;
-        }
+            super(registry);
 
-        if( _value.getHandleMax() != null)
-        {
-            return 5;
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getOutgoingWindow() != null)
+        private int calculateCount()
         {
-            return 4;
-        }
 
-        if( _value.getIncomingWindow() != null)
-        {
-            return 3;
-        }
 
-        if( _value.getNextOutgoingId() != null)
-        {
-            return 2;
-        }
+            if( _value.getProperties() != null)
+            {
+                return 8;
+            }
 
-        if( _value.getRemoteChannel() != null)
-        {
-            return 1;
-        }
+            if( _value.getDesiredCapabilities() != null)
+            {
+                return 7;
+            }
 
-        return 0;
-    }
+            if( _value.getOfferedCapabilities() != null)
+            {
+                return 6;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getHandleMax() != null)
+            {
+                return 5;
+            }
 
+            if( _value.getOutgoingWindow() != null)
+            {
+                return 4;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000011L);
-    }
+            if( _value.getIncomingWindow() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getNextOutgoingId() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Begin>
-    {
-        private int _field;
+            if( _value.getRemoteChannel() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Begin value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -178,11 +151,6 @@ public class BeginWriter extends Abstrac
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -192,9 +160,10 @@ public class BeginWriter extends Abstrac
     private static Factory<Begin> FACTORY = new Factory<Begin>()
     {
 
-        public ValueWriter<Begin> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Begin> newInstance(final Registry registry, final Begin object)
         {
-            return new BeginWriter(registry);
+            return new BeginWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,69 +33,39 @@ import org.apache.qpid.server.protocol.v
 
 public class CloseWriter extends AbstractDescribedTypeWriter<Close>
 {
-    private Close _value;
-    private int _count = -1;
-
-    public CloseWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final Close value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x18);
 
 
-        if( _value.getError() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
+    private CloseWriter(final Registry registry, final Close object)
     {
-        _value = null;
-        _count = -1;
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000018L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<Close>
+    private static class Writer extends AbstractListWriter<Close>
     {
+        private final Close _value;
+        private final int _count;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final Close object)
         {
             super(registry);
+
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final Close value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getError() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
+
         @Override
         protected int getCount()
         {
@@ -122,11 +93,6 @@ public class CloseWriter extends Abstrac
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +102,10 @@ public class CloseWriter extends Abstrac
     private static Factory<Close> FACTORY = new Factory<Close>()
     {
 
-        public ValueWriter<Close> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Close> newInstance(final Registry registry, final Close object)
         {
-            return new CloseWriter(registry);
+            return new CloseWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,78 +33,47 @@ import org.apache.qpid.server.protocol.v
 
 public class DetachWriter extends AbstractDescribedTypeWriter<Detach>
 {
-    private Detach _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x16);
 
-    public DetachWriter(final Registry registry)
+    private DetachWriter(final Registry registry, final Detach object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Detach value)
+    private static class Writer extends AbstractListWriter<Detach>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
+        private final Detach _value;
+        private final int _count;
+        private int _field;
 
-        if( _value.getError() != null)
+        public Writer(final Registry registry, final Detach object)
         {
-            return 3;
-        }
+            super(registry);
 
-        if( _value.getClosed() != null)
-        {
-            return 2;
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getHandle() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000016L);
-    }
+            if( _value.getError() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getClosed() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Detach>
-    {
-        private int _field;
+            if( _value.getHandle() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Detach value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -138,11 +108,6 @@ public class DetachWriter extends Abstra
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -152,9 +117,10 @@ public class DetachWriter extends Abstra
     private static Factory<Detach> FACTORY = new Factory<Detach>()
     {
 
-        public ValueWriter<Detach> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Detach> newInstance(final Registry registry, final Detach object)
         {
-            return new DetachWriter(registry);
+            return new DetachWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,92 +33,63 @@ import org.apache.qpid.server.protocol.v
 
 public class DispositionWriter extends AbstractDescribedTypeWriter<Disposition>
 {
-    private Disposition _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x15);
 
-    public DispositionWriter(final Registry registry)
-    {
-        super(registry);
-    }
 
-    @Override
-    protected void onSetValue(final Disposition value)
+    private DispositionWriter(final Registry registry, final Disposition object)
     {
-        _value = value;
-        _count = calculateCount();
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Disposition>
     {
+        private final Disposition _value;
+        private final int _count;
 
+        private int _field;
 
-        if( _value.getBatchable() != null)
-        {
-            return 6;
-        }
-
-        if( _value.getState() != null)
-        {
-            return 5;
-        }
-
-        if( _value.getSettled() != null)
-        {
-            return 4;
-        }
-
-        if( _value.getLast() != null)
+        public Writer(final Registry registry, final Disposition object)
         {
-            return 3;
-        }
+            super(registry);
 
-        if( _value.getFirst() != null)
-        {
-            return 2;
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getRole() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
-
-        return 0;
-    }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getBatchable() != null)
+            {
+                return 6;
+            }
 
+            if( _value.getState() != null)
+            {
+                return 5;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000015L);
-    }
+            if( _value.getSettled() != null)
+            {
+                return 4;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getLast() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<Disposition>
-    {
-        private int _field;
+            if( _value.getFirst() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getRole() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final Disposition value)
-        {
-            reset();
+            return 0;
         }
 
         @Override
@@ -162,11 +134,6 @@ public class DispositionWriter extends A
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -176,9 +143,10 @@ public class DispositionWriter extends A
     private static Factory<Disposition> FACTORY = new Factory<Disposition>()
     {
 
-        public ValueWriter<Disposition> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Disposition> newInstance(final Registry registry, final Disposition object)
         {
-            return new DispositionWriter(registry);
+            return new DispositionWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,67 +33,35 @@ import org.apache.qpid.server.protocol.v
 
 public class EndWriter extends AbstractDescribedTypeWriter<End>
 {
-    private End _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x17);
 
-    public EndWriter(final Registry registry)
+    private EndWriter(final Registry registry, final End object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final End value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getError() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000017L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<End>
+    private static class Writer extends AbstractListWriter<End>
     {
+        private final End _value;
+        private final int _count;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final End object)
         {
             super(registry);
+
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final End value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getError() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -122,11 +91,6 @@ public class EndWriter extends AbstractD
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +100,10 @@ public class EndWriter extends AbstractD
     private static Factory<End> FACTORY = new Factory<End>()
     {
 
-        public ValueWriter<End> newInstance(Registry registry)
+        @Override
+        public ValueWriter<End> newInstance(final Registry registry, final End object)
         {
-            return new EndWriter(registry);
+            return new EndWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,79 +33,46 @@ import org.apache.qpid.server.protocol.v
 
 public class ErrorWriter extends AbstractDescribedTypeWriter<Error>
 {
-    private Error _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x1D);
 
-    public ErrorWriter(final Registry registry)
+    private ErrorWriter(final Registry registry, final Error object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Error value)
+    private static class Writer extends AbstractListWriter<Error>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
+        private final Error _value;
+        private final int _count;
+        private int _field;
 
-        if( _value.getInfo() != null)
+        public Writer(final Registry registry, final Error object)
         {
-            return 3;
-        }
+            super(registry);
 
-        if( _value.getDescription() != null)
-        {
-            return 2;
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getCondition() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x000000000000001dL);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getInfo() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<Error>
-    {
-        private int _field;
+            if( _value.getDescription() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getCondition() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final Error value)
-        {
-            reset();
+            return 0;
         }
-
         @Override
         protected int getCount()
         {
@@ -138,11 +106,6 @@ public class ErrorWriter extends Abstrac
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -152,9 +115,10 @@ public class ErrorWriter extends Abstrac
     private static Factory<Error> FACTORY = new Factory<Error>()
     {
 
-        public ValueWriter<Error> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Error> newInstance(final Registry registry, final Error object)
         {
-            return new ErrorWriter(registry);
+            return new ErrorWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,118 +33,88 @@ import org.apache.qpid.server.protocol.v
 
 public class FlowWriter extends AbstractDescribedTypeWriter<Flow>
 {
-    private Flow _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x13);
 
-    public FlowWriter(final Registry registry)
+    private FlowWriter(final Registry registry, final Flow object)
     {
-        super(registry);
-    }
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
 
-    @Override
-    protected void onSetValue(final Flow value)
-    {
-        _value = value;
-        _count = calculateCount();
     }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Flow>
     {
+        private final Flow _value;
+        private final int _count;
+        private int _field;
 
-
-        if( _value.getProperties() != null)
-        {
-            return 11;
-        }
-
-        if( _value.getEcho() != null)
-        {
-            return 10;
-        }
-
-        if( _value.getDrain() != null)
-        {
-            return 9;
-        }
-
-        if( _value.getAvailable() != null)
+        public Writer(final Registry registry, final Flow object)
         {
-            return 8;
-        }
+            super(registry);
 
-        if( _value.getLinkCredit() != null)
-        {
-            return 7;
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getDeliveryCount() != null)
+        private int calculateCount()
         {
-            return 6;
-        }
-
-        if( _value.getHandle() != null)
-        {
-            return 5;
-        }
+            if( _value.getProperties() != null)
+            {
+                return 11;
+            }
 
-        if( _value.getOutgoingWindow() != null)
-        {
-            return 4;
-        }
+            if( _value.getEcho() != null)
+            {
+                return 10;
+            }
 
-        if( _value.getNextOutgoingId() != null)
-        {
-            return 3;
-        }
+            if( _value.getDrain() != null)
+            {
+                return 9;
+            }
 
-        if( _value.getIncomingWindow() != null)
-        {
-            return 2;
-        }
+            if( _value.getAvailable() != null)
+            {
+                return 8;
+            }
 
-        if( _value.getNextIncomingId() != null)
-        {
-            return 1;
-        }
+            if( _value.getLinkCredit() != null)
+            {
+                return 7;
+            }
 
-        return 0;
-    }
+            if( _value.getDeliveryCount() != null)
+            {
+                return 6;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getHandle() != null)
+            {
+                return 5;
+            }
 
+            if( _value.getOutgoingWindow() != null)
+            {
+                return 4;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000013L);
-    }
+            if( _value.getNextOutgoingId() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getIncomingWindow() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Flow>
-    {
-        private int _field;
+            if( _value.getNextIncomingId() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Flow value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -202,11 +173,6 @@ public class FlowWriter extends Abstract
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -216,9 +182,10 @@ public class FlowWriter extends Abstract
     private static Factory<Flow> FACTORY = new Factory<Flow>()
     {
 
-        public ValueWriter<Flow> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Flow> newInstance(final Registry registry, final Flow object)
         {
-            return new FlowWriter(registry);
+            return new FlowWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,113 +33,82 @@ import org.apache.qpid.server.protocol.v
 
 public class OpenWriter extends AbstractDescribedTypeWriter<Open>
 {
-    private Open _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x10);
 
-    public OpenWriter(final Registry registry)
+    private OpenWriter(final Registry registry, final Open object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Open value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Open>
     {
+        private final Open _value;
+        private final int _count;
 
+        private int _field;
 
-        if( _value.getProperties() != null)
-        {
-            return 10;
-        }
-
-        if( _value.getDesiredCapabilities() != null)
-        {
-            return 9;
-        }
-
-        if( _value.getOfferedCapabilities() != null)
-        {
-            return 8;
-        }
-
-        if( _value.getIncomingLocales() != null)
-        {
-            return 7;
-        }
-
-        if( _value.getOutgoingLocales() != null)
-        {
-            return 6;
-        }
-
-        if( _value.getIdleTimeOut() != null)
+        public Writer(final Registry registry, final Open object)
         {
-            return 5;
+            super(registry);
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getChannelMax() != null)
+        private int calculateCount()
         {
-            return 4;
-        }
+            if( _value.getProperties() != null)
+            {
+                return 10;
+            }
 
-        if( _value.getMaxFrameSize() != null)
-        {
-            return 3;
-        }
+            if( _value.getDesiredCapabilities() != null)
+            {
+                return 9;
+            }
 
-        if( _value.getHostname() != null)
-        {
-            return 2;
-        }
+            if( _value.getOfferedCapabilities() != null)
+            {
+                return 8;
+            }
 
-        if( _value.getContainerId() != null)
-        {
-            return 1;
-        }
+            if( _value.getIncomingLocales() != null)
+            {
+                return 7;
+            }
 
-        return 0;
-    }
+            if( _value.getOutgoingLocales() != null)
+            {
+                return 6;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getIdleTimeOut() != null)
+            {
+                return 5;
+            }
 
+            if( _value.getChannelMax() != null)
+            {
+                return 4;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000010L);
-    }
+            if( _value.getMaxFrameSize() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getHostname() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Open>
-    {
-        private int _field;
+            if( _value.getContainerId() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Open value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -194,11 +164,6 @@ public class OpenWriter extends Abstract
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -208,9 +173,10 @@ public class OpenWriter extends Abstract
     private static Factory<Open> FACTORY = new Factory<Open>()
     {
 
-        public ValueWriter<Open> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Open> newInstance(final Registry registry, final Open object)
         {
-            return new OpenWriter(registry);
+            return new OpenWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java?rev=1773584&r1=1773583&r2=1773584&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java Sun Dec 11 16:01:06 2016
@@ -25,6 +25,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractListWriter;
+import org.apache.qpid.server.protocol.v1_0.codec.UnsignedLongWriter;
 import org.apache.qpid.server.protocol.v1_0.codec.ValueWriter;
 
 import org.apache.qpid.server.protocol.v1_0.type.UnsignedLong;
@@ -32,117 +33,87 @@ import org.apache.qpid.server.protocol.v
 
 public class TransferWriter extends AbstractDescribedTypeWriter<Transfer>
 {
-    private Transfer _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x14);
 
-    public TransferWriter(final Registry registry)
-    {
-        super(registry);
-    }
 
-    @Override
-    protected void onSetValue(final Transfer value)
+    private TransferWriter(final Registry registry, final Transfer object)
     {
-        _value = value;
-        _count = calculateCount();
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Transfer>
     {
+        private final Transfer _value;
+        private final int _count;
 
+        private int _field;
 
-        if( _value.getBatchable() != null)
-        {
-            return 11;
-        }
-
-        if( _value.getAborted() != null)
-        {
-            return 10;
-        }
-
-        if( _value.getResume() != null)
-        {
-            return 9;
-        }
-
-        if( _value.getState() != null)
-        {
-            return 8;
-        }
-
-        if( _value.getRcvSettleMode() != null)
-        {
-            return 7;
-        }
-
-        if( _value.getMore() != null)
+        public Writer(final Registry registry, final Transfer object)
         {
-            return 6;
-        }
+            super(registry);
 
-        if( _value.getSettled() != null)
-        {
-            return 5;
+            _value = object;
+            _count = calculateCount();
         }
 
-        if( _value.getMessageFormat() != null)
+        private int calculateCount()
         {
-            return 4;
-        }
+            if( _value.getBatchable() != null)
+            {
+                return 11;
+            }
 
-        if( _value.getDeliveryTag() != null)
-        {
-            return 3;
-        }
+            if( _value.getAborted() != null)
+            {
+                return 10;
+            }
 
-        if( _value.getDeliveryId() != null)
-        {
-            return 2;
-        }
+            if( _value.getResume() != null)
+            {
+                return 9;
+            }
 
-        if( _value.getHandle() != null)
-        {
-            return 1;
-        }
+            if( _value.getState() != null)
+            {
+                return 8;
+            }
 
-        return 0;
-    }
+            if( _value.getRcvSettleMode() != null)
+            {
+                return 7;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getMore() != null)
+            {
+                return 6;
+            }
 
+            if( _value.getSettled() != null)
+            {
+                return 5;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000014L);
-    }
+            if( _value.getMessageFormat() != null)
+            {
+                return 4;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getDeliveryTag() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<Transfer>
-    {
-        private int _field;
+            if( _value.getDeliveryId() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getHandle() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final Transfer value)
-        {
-            reset();
+            return 0;
         }
 
         @Override
@@ -202,11 +173,6 @@ public class TransferWriter extends Abst
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -216,9 +182,10 @@ public class TransferWriter extends Abst
     private static Factory<Transfer> FACTORY = new Factory<Transfer>()
     {
 
-        public ValueWriter<Transfer> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Transfer> newInstance(final Registry registry, final Transfer object)
         {
-            return new TransferWriter(registry);
+            return new TransferWriter(registry, object);
         }
     };
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message