qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1773584 [3/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/messaging/codec/DeleteOnNoLinksWriter.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/messaging/codec/DeleteOnNoLinksWriter.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/messaging/codec/DeleteOnNoLinksWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksWriter.java Sun Dec 11 16:01:06 2016
@@ -24,111 +24,26 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.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.ListWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinks;
 
 public class DeleteOnNoLinksWriter extends AbstractDescribedTypeWriter<DeleteOnNoLinks>
 {
-    private DeleteOnNoLinks _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x2C);
 
     public DeleteOnNoLinksWriter(final Registry registry)
     {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final DeleteOnNoLinks value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x000000000000002cL);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<DeleteOnNoLinks>
-    {
-        private int _field;
-
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
-
-        @Override
-        protected void onSetValue(final DeleteOnNoLinks value)
-        {
-            reset();
-        }
-
-        @Override
-        protected int getCount()
-        {
-            return _count;
-        }
-
-        @Override
-        protected boolean hasNext()
-        {
-            return _field < _count;
-        }
-
-        @Override
-        protected Object next()
-        {
-            switch(_field++)
-            {
-
-                default:
-                    return null;
-            }
-        }
-
-        @Override
-        protected void clear()
-        {
-        }
-
-        @Override
-        protected void reset()
-        {
-            _field = 0;
-        }
+        super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER);
     }
 
     private static Factory<DeleteOnNoLinks> FACTORY = new Factory<DeleteOnNoLinks>()
     {
 
-        public ValueWriter<DeleteOnNoLinks> newInstance(Registry registry)
+        @Override
+        public ValueWriter<DeleteOnNoLinks> newInstance(final Registry registry, final DeleteOnNoLinks object)
         {
             return new DeleteOnNoLinksWriter(registry);
         }

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesWriter.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/messaging/codec/DeleteOnNoMessagesWriter.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/messaging/codec/DeleteOnNoMessagesWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesWriter.java Sun Dec 11 16:01:06 2016
@@ -24,113 +24,29 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.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.ListWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoMessages;
 
 public class DeleteOnNoMessagesWriter extends AbstractDescribedTypeWriter<DeleteOnNoMessages>
 {
-    private DeleteOnNoMessages _value;
-    private int _count = -1;
-
-    public DeleteOnNoMessagesWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final DeleteOnNoMessages value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x2D);
 
-
-    protected Object getDescriptor()
+    public DeleteOnNoMessagesWriter(final Registry registry,
+                                    final DeleteOnNoMessages object)
     {
-        return UnsignedLong.valueOf(0x000000000000002dL);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<DeleteOnNoMessages>
-    {
-        private int _field;
-
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
-
-        @Override
-        protected void onSetValue(final DeleteOnNoMessages value)
-        {
-            reset();
-        }
-
-        @Override
-        protected int getCount()
-        {
-            return _count;
-        }
-
-        @Override
-        protected boolean hasNext()
-        {
-            return _field < _count;
-        }
-
-        @Override
-        protected Object next()
-        {
-            switch(_field++)
-            {
-
-                default:
-                    return null;
-            }
-        }
-
-        @Override
-        protected void clear()
-        {
-        }
-
-        @Override
-        protected void reset()
-        {
-            _field = 0;
-        }
+        super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER);
     }
 
     private static Factory<DeleteOnNoMessages> FACTORY = new Factory<DeleteOnNoMessages>()
     {
 
-        public ValueWriter<DeleteOnNoMessages> newInstance(Registry registry)
+        @Override
+        public ValueWriter<DeleteOnNoMessages> newInstance(final Registry registry, final DeleteOnNoMessages object)
         {
-            return new DeleteOnNoMessagesWriter(registry);
+            return new DeleteOnNoMessagesWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsWriter.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/messaging/codec/DeliveryAnnotationsWriter.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/messaging/codec/DeliveryAnnotationsWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsWriter.java Sun Dec 11 16:01:06 2016
@@ -24,6 +24,7 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
+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;
@@ -31,44 +32,22 @@ import org.apache.qpid.server.protocol.v
 
 public class DeliveryAnnotationsWriter extends AbstractDescribedTypeWriter<DeliveryAnnotations>
 {
-    private DeliveryAnnotations _value;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x71);
 
 
-
-    public DeliveryAnnotationsWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final DeliveryAnnotations value)
-    {
-        _value = value;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-    }
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000071L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
+    public DeliveryAnnotationsWriter(final Registry registry,
+                                     final DeliveryAnnotations object)
     {
-        return getRegistry().getValueWriter(_value.getValue());
+        super(DESCRIPTOR_WRITER, registry.getValueWriter(object));
     }
 
     private static Factory<DeliveryAnnotations> FACTORY = new Factory<DeliveryAnnotations>()
     {
 
-        public ValueWriter<DeliveryAnnotations> newInstance(Registry registry)
+        @Override
+        public ValueWriter<DeliveryAnnotations> newInstance(final Registry registry, final DeliveryAnnotations object)
         {
-            return new DeliveryAnnotationsWriter(registry);
+            return new DeliveryAnnotationsWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterWriter.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/messaging/codec/ExactSubjectFilterWriter.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/messaging/codec/ExactSubjectFilterWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterWriter.java Sun Dec 11 16:01:06 2016
@@ -24,49 +24,28 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.ExactSubjectFilter;
 
 public class ExactSubjectFilterWriter extends AbstractDescribedTypeWriter<ExactSubjectFilter>
 {
-    private ExactSubjectFilter _value;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000000L);
 
-
-
-    public ExactSubjectFilterWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final ExactSubjectFilter value)
-    {
-        _value = value;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-    }
-
-    protected Object getDescriptor()
-    {
-        return 0x0000468C00000000L;
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
+    public ExactSubjectFilterWriter(final Registry registry,
+                                    final ExactSubjectFilter object)
     {
-        return getRegistry().getValueWriter(_value.getValue());
+        super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue()));
     }
 
     private static Factory<ExactSubjectFilter> FACTORY = new Factory<ExactSubjectFilter>()
     {
 
-        public ValueWriter<ExactSubjectFilter> newInstance(Registry registry)
+        @Override
+        public ValueWriter<ExactSubjectFilter> newInstance(final Registry registry, final ExactSubjectFilter object)
         {
-            return new ExactSubjectFilterWriter(registry);
+            return new ExactSubjectFilterWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/FooterWriter.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/messaging/codec/FooterWriter.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/messaging/codec/FooterWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/FooterWriter.java Sun Dec 11 16:01:06 2016
@@ -24,6 +24,7 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
+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;
@@ -31,44 +32,21 @@ import org.apache.qpid.server.protocol.v
 
 public class FooterWriter extends AbstractDescribedTypeWriter<Footer>
 {
-    private Footer _value;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x78);
 
-
-
-    public FooterWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final Footer value)
-    {
-        _value = value;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-    }
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000078L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
+    public FooterWriter(final Registry registry,
+                        final Footer object)
     {
-        return getRegistry().getValueWriter(_value.getValue());
+        super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue()));
     }
 
     private static Factory<Footer> FACTORY = new Factory<Footer>()
     {
 
-        public ValueWriter<Footer> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Footer> newInstance(final Registry registry, final Footer object)
         {
-            return new FooterWriter(registry);
+            return new FooterWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderWriter.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/messaging/codec/HeaderWriter.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/messaging/codec/HeaderWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderWriter.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,87 +33,57 @@ import org.apache.qpid.server.protocol.v
 
 public class HeaderWriter extends AbstractDescribedTypeWriter<Header>
 {
-    private Header _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x70);
 
-    public HeaderWriter(final Registry registry)
+    public HeaderWriter(final Registry registry, final Header object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Header value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Header>
     {
+        private final int _count;
+        private final Header _value;
+        private int _field;
 
-
-        if( _value.getDeliveryCount() != null)
-        {
-            return 5;
-        }
-
-        if( _value.getFirstAcquirer() != null)
-        {
-            return 4;
-        }
-
-        if( _value.getTtl() != null)
-        {
-            return 3;
-        }
-
-        if( _value.getPriority() != null)
+        public Writer(final Registry registry, Header value)
         {
-            return 2;
+            super(registry);
+            _value = value;
+            _count = calculateCount();
         }
 
-        if( _value.getDurable() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
 
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
 
+            if( _value.getDeliveryCount() != null)
+            {
+                return 5;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000070L);
-    }
+            if( _value.getFirstAcquirer() != null)
+            {
+                return 4;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getTtl() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<Header>
-    {
-        private int _field;
+            if( _value.getPriority() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getDurable() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final Header value)
-        {
-            reset();
+            return 0;
         }
 
         @Override
@@ -154,11 +125,6 @@ public class HeaderWriter extends Abstra
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -168,9 +134,10 @@ public class HeaderWriter extends Abstra
     private static Factory<Header> FACTORY = new Factory<Header>()
     {
 
-        public ValueWriter<Header> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Header> newInstance(final Registry registry, final Header object)
         {
-            return new HeaderWriter(registry);
+            return new HeaderWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/JMSSelectorFilterWriter.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/messaging/codec/JMSSelectorFilterWriter.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/messaging/codec/JMSSelectorFilterWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/JMSSelectorFilterWriter.java Sun Dec 11 16:01:06 2016
@@ -24,50 +24,29 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.JMSSelectorFilter;
 
 public class JMSSelectorFilterWriter extends AbstractDescribedTypeWriter<JMSSelectorFilter>
 {
-    private JMSSelectorFilter _value;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000004L);
 
-
-
-    public JMSSelectorFilterWriter(final Registry registry)
+    public JMSSelectorFilterWriter(final Registry registry,
+                                   final JMSSelectorFilter object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue()));
     }
 
-    @Override
-    protected void onSetValue(final JMSSelectorFilter value)
-    {
-        _value = value;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-    }
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000468C00000004L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        return getRegistry().getValueWriter(_value.getValue());
-    }
 
     private static Factory<JMSSelectorFilter> FACTORY = new Factory<JMSSelectorFilter>()
     {
 
-        public ValueWriter<JMSSelectorFilter> newInstance(Registry registry)
+        @Override
+        public ValueWriter<JMSSelectorFilter> newInstance(final Registry registry, final JMSSelectorFilter object)
         {
-            return new JMSSelectorFilterWriter(registry);
+            return new JMSSelectorFilterWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MatchingSubjectFilterWriter.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/messaging/codec/MatchingSubjectFilterWriter.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/messaging/codec/MatchingSubjectFilterWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MatchingSubjectFilterWriter.java Sun Dec 11 16:01:06 2016
@@ -24,50 +24,29 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.MatchingSubjectFilter;
 
 public class MatchingSubjectFilterWriter extends AbstractDescribedTypeWriter<MatchingSubjectFilter>
 {
-    private MatchingSubjectFilter _value;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000001L);
 
-
-
-    public MatchingSubjectFilterWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final MatchingSubjectFilter value)
-    {
-        _value = value;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-    }
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000468C00000001L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
+    public MatchingSubjectFilterWriter(final Registry registry,
+                                       final MatchingSubjectFilter object)
     {
-        return getRegistry().getValueWriter(_value.getValue());
+        super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue()));
     }
 
     private static Factory<MatchingSubjectFilter> FACTORY = new Factory<MatchingSubjectFilter>()
     {
 
-        public ValueWriter<MatchingSubjectFilter> newInstance(Registry registry)
+        @Override
+        public ValueWriter<MatchingSubjectFilter> newInstance(final Registry registry,
+                                                              final MatchingSubjectFilter object)
         {
-            return new MatchingSubjectFilterWriter(registry);
+            return new MatchingSubjectFilterWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MessageAnnotationsWriter.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/messaging/codec/MessageAnnotationsWriter.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/messaging/codec/MessageAnnotationsWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MessageAnnotationsWriter.java Sun Dec 11 16:01:06 2016
@@ -24,6 +24,7 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.codec;
 
 import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter;
+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;
@@ -31,44 +32,21 @@ import org.apache.qpid.server.protocol.v
 
 public class MessageAnnotationsWriter extends AbstractDescribedTypeWriter<MessageAnnotations>
 {
-    private MessageAnnotations _value;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x72);
 
-
-
-    public MessageAnnotationsWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final MessageAnnotations value)
-    {
-        _value = value;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-    }
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000072L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
+    public MessageAnnotationsWriter(final Registry registry,
+                                    final MessageAnnotations object)
     {
-        return getRegistry().getValueWriter(_value.getValue());
+        super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue()));
     }
 
     private static Factory<MessageAnnotations> FACTORY = new Factory<MessageAnnotations>()
     {
 
-        public ValueWriter<MessageAnnotations> newInstance(Registry registry)
+        @Override
+        public ValueWriter<MessageAnnotations> newInstance(final Registry registry, final MessageAnnotations object)
         {
-            return new MessageAnnotationsWriter(registry);
+            return new MessageAnnotationsWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedWriter.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/messaging/codec/ModifiedWriter.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/messaging/codec/ModifiedWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedWriter.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,77 +33,46 @@ import org.apache.qpid.server.protocol.v
 
 public class ModifiedWriter extends AbstractDescribedTypeWriter<Modified>
 {
-    private Modified _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x27);
 
-    public ModifiedWriter(final Registry registry)
+    public ModifiedWriter(final Registry registry, final Modified object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Modified value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Modified>
     {
+        private int _field;
+        private final int _count;
+        private final Modified _value;
 
-
-        if( _value.getMessageAnnotations() != null)
-        {
-            return 3;
-        }
-
-        if( _value.getUndeliverableHere() != null)
+        public Writer(final Registry registry, Modified value)
         {
-            return 2;
+            super(registry);
+            _value = value;
+            _count = calculateCount();
         }
 
-        if( _value.getDeliveryFailed() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
 
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000027L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getMessageAnnotations() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<Modified>
-    {
-        private int _field;
+            if( _value.getUndeliverableHere() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getDeliveryFailed() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final Modified value)
-        {
-            reset();
+            return 0;
         }
 
         @Override
@@ -138,11 +108,6 @@ public class ModifiedWriter extends Abst
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -152,9 +117,10 @@ public class ModifiedWriter extends Abst
     private static Factory<Modified> FACTORY = new Factory<Modified>()
     {
 
-        public ValueWriter<Modified> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Modified> newInstance(final Registry registry, final Modified object)
         {
-            return new ModifiedWriter(registry);
+            return new ModifiedWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/NoLocalFilterWriter.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/messaging/codec/NoLocalFilterWriter.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/messaging/codec/NoLocalFilterWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/NoLocalFilterWriter.java Sun Dec 11 16:01:06 2016
@@ -25,57 +25,25 @@ 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.ListWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.NoLocalFilter;
 
 public class NoLocalFilterWriter extends AbstractDescribedTypeWriter<NoLocalFilter>
 {
-    private NoLocalFilter _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000003L);
 
     public NoLocalFilterWriter(final Registry registry)
     {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final NoLocalFilter value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000468C00000003L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        return new ListWriter.EmptyListValueWriter();
+        super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER);
     }
 
     private static Factory<NoLocalFilter> FACTORY = new Factory<NoLocalFilter>()
     {
 
-        public ValueWriter<NoLocalFilter> newInstance(Registry registry)
+        @Override
+        public ValueWriter<NoLocalFilter> newInstance(final Registry registry, final NoLocalFilter object)
         {
             return new NoLocalFilterWriter(registry);
         }

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesWriter.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/messaging/codec/PropertiesWriter.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/messaging/codec/PropertiesWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesWriter.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,127 +33,96 @@ import org.apache.qpid.server.protocol.v
 
 public class PropertiesWriter extends AbstractDescribedTypeWriter<Properties>
 {
-    private Properties _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x73);
 
-    public PropertiesWriter(final Registry registry)
+    public PropertiesWriter(final Registry registry, final Properties object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Properties value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
 
-    private int calculateCount()
+    private static class Writer extends AbstractListWriter<Properties>
     {
+        private int _field;
+        private final Properties _value;
+        private final int _count;
 
-
-        if( _value.getReplyToGroupId() != null)
-        {
-            return 13;
-        }
-
-        if( _value.getGroupSequence() != null)
-        {
-            return 12;
-        }
-
-        if( _value.getGroupId() != null)
-        {
-            return 11;
-        }
-
-        if( _value.getCreationTime() != null)
-        {
-            return 10;
-        }
-
-        if( _value.getAbsoluteExpiryTime() != null)
-        {
-            return 9;
-        }
-
-        if( _value.getContentEncoding() != null)
+        public Writer(final Registry registry, Properties value)
         {
-            return 8;
-        }
+            super(registry);
+            _value = value;
+            _count = calculateCount();
 
-        if( _value.getContentType() != null)
-        {
-            return 7;
         }
 
-        if( _value.getCorrelationId() != null)
+        private int calculateCount()
         {
-            return 6;
-        }
+            if( _value.getReplyToGroupId() != null)
+            {
+                return 13;
+            }
 
-        if( _value.getReplyTo() != null)
-        {
-            return 5;
-        }
+            if( _value.getGroupSequence() != null)
+            {
+                return 12;
+            }
 
-        if( _value.getSubject() != null)
-        {
-            return 4;
-        }
+            if( _value.getGroupId() != null)
+            {
+                return 11;
+            }
 
-        if( _value.getTo() != null)
-        {
-            return 3;
-        }
+            if( _value.getCreationTime() != null)
+            {
+                return 10;
+            }
 
-        if( _value.getUserId() != null)
-        {
-            return 2;
-        }
+            if( _value.getAbsoluteExpiryTime() != null)
+            {
+                return 9;
+            }
 
-        if( _value.getMessageId() != null)
-        {
-            return 1;
-        }
+            if( _value.getContentEncoding() != null)
+            {
+                return 8;
+            }
 
-        return 0;
-    }
+            if( _value.getContentType() != null)
+            {
+                return 7;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getCorrelationId() != null)
+            {
+                return 6;
+            }
 
+            if( _value.getReplyTo() != null)
+            {
+                return 5;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000073L);
-    }
+            if( _value.getSubject() != null)
+            {
+                return 4;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getTo() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<Properties>
-    {
-        private int _field;
+            if( _value.getUserId() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getMessageId() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final Properties value)
-        {
-            reset();
+            return 0;
         }
 
         @Override
@@ -218,11 +188,6 @@ public class PropertiesWriter extends Ab
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -232,9 +197,10 @@ public class PropertiesWriter extends Ab
     private static Factory<Properties> FACTORY = new Factory<Properties>()
     {
 
-        public ValueWriter<Properties> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Properties> newInstance(final Registry registry, final Properties object)
         {
-            return new PropertiesWriter(registry);
+            return new PropertiesWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedWriter.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/messaging/codec/ReceivedWriter.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/messaging/codec/ReceivedWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedWriter.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 ReceivedWriter extends AbstractDescribedTypeWriter<Received>
 {
-    private Received _value;
-    private int _count = -1;
-
-    public ReceivedWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final Received value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getSectionOffset() != null)
-        {
-            return 2;
-        }
-
-        if( _value.getSectionNumber() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x23);
 
 
-    protected Object getDescriptor()
+    private ReceivedWriter(final Registry registry, final Received object)
     {
-        return UnsignedLong.valueOf(0x0000000000000023L);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
+    private static class Writer extends AbstractListWriter<Received>
     {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+        private final Received _value;
+        private final int _count;
 
-    private class Writer extends AbstractListWriter<Received>
-    {
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, Received value)
         {
             super(registry);
+            _value = value;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final Received value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getSectionOffset() != null)
+            {
+                return 2;
+            }
+
+            if( _value.getSectionNumber() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -130,11 +100,6 @@ public class ReceivedWriter extends Abst
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -144,9 +109,10 @@ public class ReceivedWriter extends Abst
     private static Factory<Received> FACTORY = new Factory<Received>()
     {
 
-        public ValueWriter<Received> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Received> newInstance(final Registry registry, final Received object)
         {
-            return new ReceivedWriter(registry);
+            return new ReceivedWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedWriter.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/messaging/codec/RejectedWriter.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/messaging/codec/RejectedWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedWriter.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 RejectedWriter extends AbstractDescribedTypeWriter<Rejected>
 {
-    private Rejected _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x25);
 
-    public RejectedWriter(final Registry registry)
+    private RejectedWriter(final Registry registry, final Rejected object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Rejected 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(0x0000000000000025L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<Rejected>
+    private static class Writer extends AbstractListWriter<Rejected>
     {
+        private final Rejected _value;
+        private final int _count;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, Rejected value)
         {
             super(registry);
+            _value = value;
+            _count = calculateCount();
+
         }
 
-        @Override
-        protected void onSetValue(final Rejected value)
+        private int calculateCount()
         {
-            reset();
-        }
 
+
+            if( _value.getError() != null)
+            {
+                return 1;
+            }
+
+            return 0;
+        }
         @Override
         protected int getCount()
         {
@@ -122,11 +92,6 @@ public class RejectedWriter extends Abst
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +101,10 @@ public class RejectedWriter extends Abst
     private static Factory<Rejected> FACTORY = new Factory<Rejected>()
     {
 
-        public ValueWriter<Rejected> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Rejected> newInstance(final Registry registry, final Rejected object)
         {
-            return new RejectedWriter(registry);
+            return new RejectedWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedWriter.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/messaging/codec/ReleasedWriter.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/messaging/codec/ReleasedWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedWriter.java Sun Dec 11 16:01:06 2016
@@ -24,111 +24,26 @@
 package org.apache.qpid.server.protocol.v1_0.type.messaging.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.ListWriter;
+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;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.Released;
 
 public class ReleasedWriter extends AbstractDescribedTypeWriter<Released>
 {
-    private Released _value;
-    private int _count = -1;
-
-    public ReleasedWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final Released value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x26);
 
-
-    protected Object getDescriptor()
+    private ReleasedWriter(final Registry registry)
     {
-        return UnsignedLong.valueOf(0x0000000000000026L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<Released>
-    {
-        private int _field;
-
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
-
-        @Override
-        protected void onSetValue(final Released value)
-        {
-            reset();
-        }
-
-        @Override
-        protected int getCount()
-        {
-            return _count;
-        }
-
-        @Override
-        protected boolean hasNext()
-        {
-            return _field < _count;
-        }
-
-        @Override
-        protected Object next()
-        {
-            switch(_field++)
-            {
-
-                default:
-                    return null;
-            }
-        }
-
-        @Override
-        protected void clear()
-        {
-        }
-
-        @Override
-        protected void reset()
-        {
-            _field = 0;
-        }
+        super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER);
     }
 
     private static Factory<Released> FACTORY = new Factory<Released>()
     {
 
-        public ValueWriter<Released> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Released> newInstance(final Registry registry, final Released object)
         {
             return new ReleasedWriter(registry);
         }

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceWriter.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/messaging/codec/SourceWriter.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/messaging/codec/SourceWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceWriter.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,86 @@ import org.apache.qpid.server.protocol.v
 
 public class SourceWriter extends AbstractDescribedTypeWriter<Source>
 {
-    private Source _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x28);
 
-    public SourceWriter(final Registry registry)
+    private SourceWriter(final Registry registry, final Source object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Source value)
+    private static class Writer extends AbstractListWriter<Source>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getCapabilities() != null)
-        {
-            return 11;
-        }
-
-        if( _value.getOutcomes() != null)
-        {
-            return 10;
-        }
-
-        if( _value.getDefaultOutcome() != null)
-        {
-            return 9;
-        }
-
-        if( _value.getFilter() != null)
-        {
-            return 8;
-        }
-
-        if( _value.getDistributionMode() != null)
-        {
-            return 7;
-        }
+        private int _field;
+        private final Source _value;
+        private final int _count;
 
-        if( _value.getDynamicNodeProperties() != null)
+        public Writer(final Registry registry, Source value)
         {
-            return 6;
+            super(registry);
+            _value = value;
+            _count = calculateCount();
         }
 
-        if( _value.getDynamic() != null)
+        private int calculateCount()
         {
-            return 5;
-        }
+            if( _value.getCapabilities() != null)
+            {
+                return 11;
+            }
 
-        if( _value.getTimeout() != null)
-        {
-            return 4;
-        }
+            if( _value.getOutcomes() != null)
+            {
+                return 10;
+            }
 
-        if( _value.getExpiryPolicy() != null)
-        {
-            return 3;
-        }
+            if( _value.getDefaultOutcome() != null)
+            {
+                return 9;
+            }
 
-        if( _value.getDurable() != null)
-        {
-            return 2;
-        }
+            if( _value.getFilter() != null)
+            {
+                return 8;
+            }
 
-        if( _value.getAddress() != null)
-        {
-            return 1;
-        }
+            if( _value.getDistributionMode() != null)
+            {
+                return 7;
+            }
 
-        return 0;
-    }
+            if( _value.getDynamicNodeProperties() != null)
+            {
+                return 6;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getDynamic() != null)
+            {
+                return 5;
+            }
 
+            if( _value.getTimeout() != null)
+            {
+                return 4;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000028L);
-    }
+            if( _value.getExpiryPolicy() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getDurable() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Source>
-    {
-        private int _field;
+            if( _value.getAddress() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Source value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -202,11 +171,6 @@ public class SourceWriter extends Abstra
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -216,9 +180,10 @@ public class SourceWriter extends Abstra
     private static Factory<Source> FACTORY = new Factory<Source>()
     {
 
-        public ValueWriter<Source> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Source> newInstance(final Registry registry, final Source object)
         {
-            return new SourceWriter(registry);
+            return new SourceWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetWriter.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/messaging/codec/TargetWriter.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/messaging/codec/TargetWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetWriter.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,98 +33,66 @@ import org.apache.qpid.server.protocol.v
 
 public class TargetWriter extends AbstractDescribedTypeWriter<Target>
 {
-    private Target _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x29);
 
-    public TargetWriter(final Registry registry)
+    public TargetWriter(final Registry registry, final Target object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final Target value)
+    private static class Writer extends AbstractListWriter<Target>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getCapabilities() != null)
-        {
-            return 7;
-        }
-
-        if( _value.getDynamicNodeProperties() != null)
-        {
-            return 6;
-        }
-
-        if( _value.getDynamic() != null)
-        {
-            return 5;
-        }
-
-        if( _value.getTimeout() != null)
-        {
-            return 4;
-        }
-
-        if( _value.getExpiryPolicy() != null)
-        {
-            return 3;
-        }
+        private final Target _value;
+        private final int _count;
+        private int _field;
 
-        if( _value.getDurable() != null)
+        public Writer(final Registry registry, Target value)
         {
-            return 2;
+            super(registry);
+            _value = value;
+            _count = calculateCount();
         }
 
-        if( _value.getAddress() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
+            if( _value.getCapabilities() != null)
+            {
+                return 7;
+            }
 
-        return 0;
-    }
+            if( _value.getDynamicNodeProperties() != null)
+            {
+                return 6;
+            }
 
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
+            if( _value.getDynamic() != null)
+            {
+                return 5;
+            }
 
+            if( _value.getTimeout() != null)
+            {
+                return 4;
+            }
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000029L);
-    }
+            if( _value.getExpiryPolicy() != null)
+            {
+                return 3;
+            }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getDurable() != null)
+            {
+                return 2;
+            }
 
-    private class Writer extends AbstractListWriter<Target>
-    {
-        private int _field;
+            if( _value.getAddress() != null)
+            {
+                return 1;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
+            return 0;
         }
 
-        @Override
-        protected void onSetValue(final Target value)
-        {
-            reset();
-        }
 
         @Override
         protected int getCount()
@@ -170,11 +139,6 @@ public class TargetWriter extends Abstra
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -184,9 +148,10 @@ public class TargetWriter extends Abstra
     private static Factory<Target> FACTORY = new Factory<Target>()
     {
 
-        public ValueWriter<Target> newInstance(Registry registry)
+        @Override
+        public ValueWriter<Target> newInstance(final Registry registry, final Target object)
         {
-            return new TargetWriter(registry);
+            return new TargetWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeWriter.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/security/codec/SaslChallengeWriter.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/security/codec/SaslChallengeWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeWriter.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,36 @@ import org.apache.qpid.server.protocol.v
 
 public class SaslChallengeWriter extends AbstractDescribedTypeWriter<SaslChallenge>
 {
-    private SaslChallenge _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x42);
 
-    public SaslChallengeWriter(final Registry registry)
+    private SaslChallengeWriter(final Registry registry,
+                                final SaslChallenge object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final SaslChallenge value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getChallenge() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000042L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<SaslChallenge>
+    private static class Writer extends AbstractListWriter<SaslChallenge>
     {
+        private SaslChallenge _value;
+        private int _count = -1;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, SaslChallenge value)
         {
             super(registry);
+            _value = value;
+            _count = calculateCount();
+
         }
 
-        @Override
-        protected void onSetValue(final SaslChallenge value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getChallenge() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -112,7 +82,6 @@ public class SaslChallengeWriter extends
         {
             switch(_field++)
             {
-
                 case 0:
                     return _value.getChallenge();
 
@@ -122,11 +91,6 @@ public class SaslChallengeWriter extends
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +100,10 @@ public class SaslChallengeWriter extends
     private static Factory<SaslChallenge> FACTORY = new Factory<SaslChallenge>()
     {
 
-        public ValueWriter<SaslChallenge> newInstance(Registry registry)
+        @Override
+        public ValueWriter<SaslChallenge> newInstance(final Registry registry, final SaslChallenge object)
         {
-            return new SaslChallengeWriter(registry);
+            return new SaslChallengeWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitWriter.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/security/codec/SaslInitWriter.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/security/codec/SaslInitWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitWriter.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,45 @@ import org.apache.qpid.server.protocol.v
 
 public class SaslInitWriter extends AbstractDescribedTypeWriter<SaslInit>
 {
-    private SaslInit _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x41);
 
-    public SaslInitWriter(final Registry registry)
+    private SaslInitWriter(final Registry registry, final SaslInit object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final SaslInit value)
+    private static class Writer extends AbstractListWriter<SaslInit>
     {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getHostname() != null)
-        {
-            return 3;
-        }
+        private final SaslInit _value;
+        private final int _count;
+        private int _field;
 
-        if( _value.getInitialResponse() != null)
+        public Writer(final Registry registry, SaslInit value)
         {
-            return 2;
+            super(registry);
+            _value = value;
+            _count = calculateCount();
         }
 
-        if( _value.getMechanism() != null)
+        private int calculateCount()
         {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000041L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
+            if( _value.getHostname() != null)
+            {
+                return 3;
+            }
 
-    private class Writer extends AbstractListWriter<SaslInit>
-    {
-        private int _field;
+            if( _value.getInitialResponse() != null)
+            {
+                return 2;
+            }
 
-        public Writer(final Registry registry)
-        {
-            super(registry);
-        }
+            if( _value.getMechanism() != null)
+            {
+                return 1;
+            }
 
-        @Override
-        protected void onSetValue(final SaslInit value)
-        {
-            reset();
+            return 0;
         }
-
         @Override
         protected int getCount()
         {
@@ -138,11 +105,6 @@ public class SaslInitWriter extends Abst
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -152,9 +114,10 @@ public class SaslInitWriter extends Abst
     private static Factory<SaslInit> FACTORY = new Factory<SaslInit>()
     {
 
-        public ValueWriter<SaslInit> newInstance(Registry registry)
+        @Override
+        public ValueWriter<SaslInit> newInstance(final Registry registry, final SaslInit object)
         {
-            return new SaslInitWriter(registry);
+            return new SaslInitWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsWriter.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/security/codec/SaslMechanismsWriter.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/security/codec/SaslMechanismsWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsWriter.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 SaslMechanismsWriter extends AbstractDescribedTypeWriter<SaslMechanisms>
 {
-    private SaslMechanisms _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x40);
 
-    public SaslMechanismsWriter(final Registry registry)
+    private SaslMechanismsWriter(final Registry registry,
+                                 final SaslMechanisms object)
     {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final SaslMechanisms value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getSaslServerMechanisms() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
 
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000040L);
     }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<SaslMechanisms>
+    private static class Writer extends AbstractListWriter<SaslMechanisms>
     {
+        private final SaslMechanisms _value;
+        private final int _count;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, SaslMechanisms object)
         {
             super(registry);
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final SaslMechanisms value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getSaslServerMechanisms() != null)
+            {
+                return 1;
+            }
+            return 0;
         }
 
         @Override
@@ -122,11 +91,6 @@ public class SaslMechanismsWriter extend
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +100,10 @@ public class SaslMechanismsWriter extend
     private static Factory<SaslMechanisms> FACTORY = new Factory<SaslMechanisms>()
     {
 
-        public ValueWriter<SaslMechanisms> newInstance(Registry registry)
+        @Override
+        public ValueWriter<SaslMechanisms> newInstance(final Registry registry, final SaslMechanisms object)
         {
-            return new SaslMechanismsWriter(registry);
+            return new SaslMechanismsWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeWriter.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/security/codec/SaslOutcomeWriter.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/security/codec/SaslOutcomeWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeWriter.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,39 @@ import org.apache.qpid.server.protocol.v
 
 public class SaslOutcomeWriter extends AbstractDescribedTypeWriter<SaslOutcome>
 {
-    private SaslOutcome _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x44);
 
-    public SaslOutcomeWriter(final Registry registry)
+    private SaslOutcomeWriter(final Registry registry, final SaslOutcome object)
     {
-        super(registry);
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    @Override
-    protected void onSetValue(final SaslOutcome value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getAdditionalData() != null)
-        {
-            return 2;
-        }
-
-        if( _value.getCode() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000044L);
-    }
-
-    @Override
-    protected ValueWriter createDescribedWriter()
-    {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
-    }
-
-    private class Writer extends AbstractListWriter<SaslOutcome>
+    private static class Writer extends AbstractListWriter<SaslOutcome>
     {
+        private final SaslOutcome _value;
+        private final int _count;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final SaslOutcome object)
         {
             super(registry);
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final SaslOutcome value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getAdditionalData() != null)
+            {
+                return 2;
+            }
+
+            if( _value.getCode() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -130,11 +98,6 @@ public class SaslOutcomeWriter extends A
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -144,9 +107,10 @@ public class SaslOutcomeWriter extends A
     private static Factory<SaslOutcome> FACTORY = new Factory<SaslOutcome>()
     {
 
-        public ValueWriter<SaslOutcome> newInstance(Registry registry)
+        @Override
+        public ValueWriter<SaslOutcome> newInstance(final Registry registry, final SaslOutcome object)
         {
-            return new SaslOutcomeWriter(registry);
+            return new SaslOutcomeWriter(registry, object);
         }
     };
 

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseWriter.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/security/codec/SaslResponseWriter.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/security/codec/SaslResponseWriter.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseWriter.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,36 @@ import org.apache.qpid.server.protocol.v
 
 public class SaslResponseWriter extends AbstractDescribedTypeWriter<SaslResponse>
 {
-    private SaslResponse _value;
-    private int _count = -1;
+    private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x43);
 
-    public SaslResponseWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final SaslResponse value)
-    {
-        _value = value;
-        _count = calculateCount();
-    }
-
-    private int calculateCount()
-    {
-
-
-        if( _value.getResponse() != null)
-        {
-            return 1;
-        }
-
-        return 0;
-    }
-
-    @Override
-    protected void clear()
-    {
-        _value = null;
-        _count = -1;
-    }
-
-
-    protected Object getDescriptor()
-    {
-        return UnsignedLong.valueOf(0x0000000000000043L);
-    }
 
-    @Override
-    protected ValueWriter createDescribedWriter()
+    private SaslResponseWriter(final Registry registry, final SaslResponse object)
     {
-        final Writer writer = new Writer(getRegistry());
-        writer.setValue(_value);
-        return writer;
+        super(DESCRIPTOR_WRITER, new Writer(registry, object));
     }
 
-    private class Writer extends AbstractListWriter<SaslResponse>
+    private static class Writer extends AbstractListWriter<SaslResponse>
     {
+        private SaslResponse _value;
+        private int _count;
         private int _field;
 
-        public Writer(final Registry registry)
+        public Writer(final Registry registry, final SaslResponse object)
         {
             super(registry);
+
+            _value = object;
+            _count = calculateCount();
         }
 
-        @Override
-        protected void onSetValue(final SaslResponse value)
+        private int calculateCount()
         {
-            reset();
+            if( _value.getResponse() != null)
+            {
+                return 1;
+            }
+
+            return 0;
         }
 
         @Override
@@ -122,11 +92,6 @@ public class SaslResponseWriter extends
         }
 
         @Override
-        protected void clear()
-        {
-        }
-
-        @Override
         protected void reset()
         {
             _field = 0;
@@ -136,9 +101,10 @@ public class SaslResponseWriter extends
     private static Factory<SaslResponse> FACTORY = new Factory<SaslResponse>()
     {
 
-        public ValueWriter<SaslResponse> newInstance(Registry registry)
+        @Override
+        public ValueWriter<SaslResponse> newInstance(final Registry registry, final SaslResponse object)
         {
-            return new SaslResponseWriter(registry);
+            return new SaslResponseWriter(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