Github user gemmellr commented on a diff in the pull request:

    https://github.com/apache/qpid-proton/pull/89#discussion_r88262982
  
    --- Diff: 
proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/ReceiverSettleMode.java
 ---
    @@ -25,13 +25,32 @@
     
     import org.apache.qpid.proton.amqp.UnsignedByte;
     
    +import java.util.HashMap;
    +import java.util.Map;
    +
     public enum ReceiverSettleMode
     {
    -    FIRST, SECOND;
    +    FIRST(0),
    +    SECOND(1);
    +
    +    private UnsignedByte value;
    +    private static Map<UnsignedByte, ReceiverSettleMode> map = new 
HashMap<>();
    +
    +    private ReceiverSettleMode(int value) {
    +        this.value = UnsignedByte.valueOf((byte)value);
    +    }
     
    -    public UnsignedByte getValue()
    -    {
    -        return UnsignedByte.valueOf((byte)ordinal());
    +    static {
    +        for (ReceiverSettleMode mode: ReceiverSettleMode.values()) {
    +            map.put(mode.value, mode);
    +        }
         }
     
    +    public static ReceiverSettleMode valueOf(UnsignedByte value) {
    +        return map.get(value);
    --- End diff --
    
    I'm actually fine with adding the method here, which is why I didn't say 
that originally ;)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to