PROTON-1925 Add type values for know Section and DeliveryState

Update the APIs of the DeliveryState and Section implementations to
return a type identifier
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java
index d21caaa..ecf11b8 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java
@@ -27,14 +27,12 @@
 import org.apache.qpid.proton.amqp.transport.DeliveryState;
 
 
-public final class Accepted
-      implements DeliveryState, Outcome
+public final class Accepted implements DeliveryState, Outcome
 {
     public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:accepted:list");
 
     private static final Accepted INSTANCE = new Accepted();
 
-
     /**
      *  TODO should this (and other DeliveryStates) have a private constructor??
      */
@@ -52,4 +50,9 @@
     {
         return INSTANCE;
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Accepted;
+    }
 }
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java
index 2a07613..53b11c6 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java
@@ -25,8 +25,7 @@
 
 import java.util.List;
 
-public final class AmqpSequence
-      implements Section
+public final class AmqpSequence implements Section
 {
     private final List _value;
 
@@ -40,7 +39,6 @@
         return _value;
     }
 
-
     @Override
     public String toString()
     {
@@ -48,5 +46,9 @@
                _value +
                '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.AmqpSequence;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue.java
index d6ae49e..9e99f51 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue.java
@@ -23,8 +23,7 @@
 
 package org.apache.qpid.proton.amqp.messaging;
 
-public final class AmqpValue
-      implements  Section
+public final class AmqpValue implements Section
 {
     private final Object _value;
 
@@ -43,5 +42,9 @@
     {
         return "AmqpValue{" + _value + '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.AmqpValue;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/ApplicationProperties.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/ApplicationProperties.java
index 80ec90b..8518f27 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/ApplicationProperties.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/ApplicationProperties.java
@@ -25,8 +25,7 @@
 
 import java.util.Map;
 
-public final class ApplicationProperties
-      implements Section
+public final class ApplicationProperties implements Section
 {
     private final Map<String, Object> _value;
 
@@ -45,5 +44,9 @@
     {
         return "ApplicationProperties{" + _value + '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.ApplicationProperties;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Data.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Data.java
index c946d14..365a4bb 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Data.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Data.java
@@ -25,8 +25,7 @@
 
 import org.apache.qpid.proton.amqp.Binary;
 
-public final class Data
-      implements Section
+public final class Data implements Section
 {
     private final Binary _value;
 
@@ -45,5 +44,9 @@
     {
         return "Data{" + _value + '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.Data;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeliveryAnnotations.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeliveryAnnotations.java
index 9ea5504..b430ca3 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeliveryAnnotations.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeliveryAnnotations.java
@@ -46,5 +46,9 @@
     {
         return "DeliveryAnnotations{" + _value + '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.DeliveryAnnotations;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Footer.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Footer.java
index 4e9a789..7e2de55 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Footer.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Footer.java
@@ -25,9 +25,7 @@
 
 import java.util.Map;
 
-
-public final class Footer
-      implements  Section
+public final class Footer implements  Section
 {
     private final Map _value;
 
@@ -46,5 +44,9 @@
     {
         return "Footer{" + _value + '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.Footer;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Header.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Header.java
index 6f67202..71d1c51 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Header.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Header.java
@@ -26,11 +26,8 @@
 import org.apache.qpid.proton.amqp.UnsignedByte;
 import org.apache.qpid.proton.amqp.UnsignedInteger;
 
-
-public final class Header
-      implements Section
+public final class Header implements Section
 {
-
     private Boolean _durable;
     private UnsignedByte _priority;
     private UnsignedInteger _ttl;
@@ -112,4 +109,9 @@
                ", deliveryCount=" + _deliveryCount +
                '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.Header;
+    }
 }
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/MessageAnnotations.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/MessageAnnotations.java
index 9bf82d6..ddb5af9 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/MessageAnnotations.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/MessageAnnotations.java
@@ -23,14 +23,13 @@
 
 package org.apache.qpid.proton.amqp.messaging;
 
-import org.apache.qpid.proton.amqp.Symbol;
-
 import java.util.Map;
 
+import org.apache.qpid.proton.amqp.Symbol;
+
 
 public final class MessageAnnotations implements Section
 {
-
     private final Map<Symbol, Object> _value;
 
     public MessageAnnotations(Map<Symbol, Object> value)
@@ -48,5 +47,9 @@
     {
         return "MessageAnnotations{" + _value + '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.MessageAnnotations;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Modified.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Modified.java
index 9b9a3a3..4948c1d 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Modified.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Modified.java
@@ -26,14 +26,13 @@
 import org.apache.qpid.proton.amqp.Symbol;
 import org.apache.qpid.proton.amqp.transport.DeliveryState;
 
-public final class Modified
-      implements DeliveryState, Outcome
+public final class Modified implements DeliveryState, Outcome
 {
     public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:modified:list");
 
     private Boolean _deliveryFailed;
     private Boolean _undeliverableHere;
-    private Map _messageAnnotations;
+    private Map<Symbol, Object> _messageAnnotations;
 
     public Boolean getDeliveryFailed()
     {
@@ -74,5 +73,9 @@
                ", messageAnnotations=" + _messageAnnotations +
                '}';
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Modified;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Properties.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Properties.java
index dbe8c31..d084cdd 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Properties.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Properties.java
@@ -29,11 +29,8 @@
 import org.apache.qpid.proton.amqp.Symbol;
 import org.apache.qpid.proton.amqp.UnsignedInteger;
 
-
-public final class Properties
-      implements  Section
+public final class Properties implements Section
 {
-
     private Object _messageId;
     private Binary _userId;
     private String _to;
@@ -218,4 +215,9 @@
                ", replyToGroupId='" + _replyToGroupId + '\'' +
                '}';
     }
+
+    @Override
+    public SectionType getType() {
+        return SectionType.Properties;
+    }
 }
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Received.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Received.java
index 796934b..ddbcf24 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Received.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Received.java
@@ -27,12 +27,8 @@
 import org.apache.qpid.proton.amqp.UnsignedLong;
 import org.apache.qpid.proton.amqp.transport.DeliveryState;
 
-
-
-public final class Received
-      implements DeliveryState
+public final class Received implements DeliveryState
 {
-
     private UnsignedInteger _sectionNumber;
     private UnsignedLong _sectionOffset;
 
@@ -56,7 +52,6 @@
         _sectionOffset = sectionOffset;
     }
 
-
     @Override
     public String toString()
     {
@@ -65,5 +60,9 @@
                ", sectionOffset=" + _sectionOffset +
                '}';
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Received;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Rejected.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Rejected.java
index 3ea3a5b..cd181b7 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Rejected.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Rejected.java
@@ -27,9 +27,7 @@
 import org.apache.qpid.proton.amqp.transport.DeliveryState;
 import org.apache.qpid.proton.amqp.transport.ErrorCondition;
 
-
-public final class Rejected
-      implements DeliveryState, Outcome
+public final class Rejected implements DeliveryState, Outcome
 {
     public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:rejected:list");
 
@@ -47,10 +45,9 @@
 
     public int size()
     {
-        return _error != null 
-                  ? 1 
-                  : 0;        
-
+        return _error != null
+                  ? 1
+                  : 0;
     }
 
     @Override
@@ -60,5 +57,9 @@
                "error=" + _error +
                '}';
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Rejected;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Released.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Released.java
index c67917f..2227e35 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Released.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Released.java
@@ -26,9 +26,7 @@
 import org.apache.qpid.proton.amqp.Symbol;
 import org.apache.qpid.proton.amqp.transport.DeliveryState;
 
-
-public final class Released
-      implements DeliveryState, Outcome
+public final class Released implements DeliveryState, Outcome
 {
     public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:released:list");
 
@@ -44,5 +42,9 @@
     {
         return INSTANCE;
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Released;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java
index 8af3595..84a0811 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java
@@ -20,10 +20,9 @@
  */
 package org.apache.qpid.proton.amqp.messaging;
 
-public interface Section
-{
-    enum SectionType
-    {
+public interface Section {
+
+    enum SectionType {
         AmqpSequence,
         AmqpValue,
         ApplicationProperties,
@@ -34,4 +33,10 @@
         MessageAnnotations,
         Properties
     }
+
+    /**
+     * @return the {@link SectionType} that describes this instance.
+     */
+    SectionType getType();
+
 }
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Declared.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Declared.java
index e049cd5..e56f974 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Declared.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Declared.java
@@ -29,8 +29,7 @@
 import org.apache.qpid.proton.amqp.transport.DeliveryState;
 
 
-public final class Declared
-      implements DeliveryState, Outcome
+public final class Declared implements DeliveryState, Outcome
 {
     public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:declared:list");
 
@@ -58,5 +57,9 @@
                "txnId=" + _txnId +
                '}';
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Declared;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TransactionalState.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TransactionalState.java
index 313d846..61e7269 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TransactionalState.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TransactionalState.java
@@ -24,13 +24,11 @@
 package org.apache.qpid.proton.amqp.transaction;
 
 import org.apache.qpid.proton.amqp.Binary;
-import org.apache.qpid.proton.amqp.transport.DeliveryState;
 import org.apache.qpid.proton.amqp.messaging.Outcome;
+import org.apache.qpid.proton.amqp.transport.DeliveryState;
 
-public final class TransactionalState
-      implements DeliveryState
+public final class TransactionalState implements DeliveryState
 {
-
     private Binary _txnId;
     private Outcome _outcome;
 
@@ -67,5 +65,9 @@
                ", outcome=" + _outcome +
                '}';
     }
+
+    @Override
+    public DeliveryStateType getType() {
+        return DeliveryStateType.Transactional;
+    }
 }
-  
\ No newline at end of file
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java
index 4f3be66..95b2709 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java
@@ -29,8 +29,7 @@
  */
 public interface DeliveryState
 {
-    enum DeliveryStateType
-    {
+    enum DeliveryStateType {
         Accepted,
         Declared,
         Modified,
@@ -39,4 +38,10 @@
         Released,
         Transactional
     }
+
+    /**
+     * @return the {@link DeliveryStateType} that this instance represents.
+     */
+    DeliveryStateType getType();
+
 }