[JAVA-2860] Decimal128 should extend Number and implement Comparable Created: 16/May/18 Updated: 28/Oct/23 Resolved: 06/Dec/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | 3.10.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Matej Tymes [X] | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Minor Change | ||||||||
| Description |
|
It would be beneficial if Decimal128 would extend the standard Java interface Number (as all numbers and BigDecimal do). This would improve compatibility with many libraries that are Decimal128 unaware, but are able to process numbers. Update: Also consider implementing Comparable |
| Comments |
| Comment by Githook User [ 14/Jan/19 ] |
|
Author: {'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}Message: Rewrite Decimal128 Groovy/Spock tests as Java Groovy does surprising things with numbers under the hood, especially for
|
| Comment by Githook User [ 14/Jan/19 ] |
|
Author: {'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}Message: Decimal128 implements Comparable
|
| Comment by Githook User [ 14/Jan/19 ] |
|
Author: {'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}Message: Handle negative zero properly in Decimal128.doubleValue
|
| Comment by Githook User [ 14/Jan/19 ] |
|
Author: {'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}Message: Handle Decimal128 values when decoding integral and decimal types
|
| Comment by Githook User [ 14/Jan/19 ] |
|
Author: {'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}Message: Fix BasicBsonEncoder to still encode Decimal128 correctly Since Decimal128 now extends Number, BasicBsonEncoder checks if value
|
| Comment by Githook User [ 14/Jan/19 ] |
|
Author: {'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}Message: org.bson.Decimal128 implements java.lang.Number
|
| Comment by Githook User [ 06/Dec/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: Rewrite Decimal128 Groovy/Spock tests as Java Groovy does surprising things with numbers under the hood, especially for
|
| Comment by Githook User [ 06/Dec/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: Decimal128 implements Comparable
|
| Comment by Githook User [ 06/Dec/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: Handle negative zero properly in Decimal128.doubleValue
|
| Comment by Jeffrey Yemin [ 04/Dec/18 ] |
|
Re-opening to implement Comparable as well. |
| Comment by Githook User [ 04/Dec/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: Handle Decimal128 values when decoding integral and decimal types
|
| Comment by Githook User [ 04/Dec/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: Fix BasicBsonEncoder to still encode Decimal128 correctly Since Decimal128 now extends Number, BasicBsonEncoder checks if value
|
| Comment by Githook User [ 04/Dec/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: org.bson.Decimal128 implements java.lang.Number
|
| Comment by Jeffrey Yemin [ 16/May/18 ] |
|
Thanks for the suggestion. As a workaround for anyone looking at this ticket, you can already call Decimal128#bigDecimalValue to get the Decimal128 as a BigDecimal, which, as the reporter notes, already implements Number. |