[
https://issues.apache.org/jira/browse/PROTON-1352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15670603#comment-15670603
]
ASF GitHub Bot commented on PROTON-1352:
----------------------------------------
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-proton/pull/89#discussion_r88248771
--- Diff:
proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/SenderSettleMode.java
---
@@ -25,13 +25,33 @@
import org.apache.qpid.proton.amqp.UnsignedByte;
+import java.util.HashMap;
+import java.util.Map;
+
public enum SenderSettleMode
{
- UNSETTLED, SETTLED, MIXED;
+ UNSETTLED(0),
+ SETTLED(1),
+ MIXED(2);
+
+ private UnsignedByte value;
+ private static Map<UnsignedByte, SenderSettleMode> map = new
HashMap<>();
+
+ private SenderSettleMode(int value) {
+ this.value = UnsignedByte.valueOf((byte)value);
+ }
- public UnsignedByte getValue()
- {
- return UnsignedByte.valueOf((byte)ordinal());
+ static {
+ for (SenderSettleMode mode: SenderSettleMode.values()) {
+ map.put(mode.value, mode);
+ }
}
+ public SenderSettleMode valueof(UnsignedByte value) {
+ return map.get(value);
--- End diff --
As with the other mode.
> Trivial casting from UnsignedByte to ReceiverSettleMode and SenderSettleMode
> ----------------------------------------------------------------------------
>
> Key: PROTON-1352
> URL: https://issues.apache.org/jira/browse/PROTON-1352
> Project: Qpid Proton
> Issue Type: Improvement
> Components: proton-j
> Affects Versions: 0.15.0
> Reporter: Paolo Patierno
> Priority: Minor
>
> Currently it's not trivial at application level execute casting from
> UnsignedByte to SenderSettleMode or ReceiverSettleMode.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]