You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by hu...@apache.org on 2021/05/04 10:07:54 UTC
[incubator-tuweni-website] 19/25: Add unsigned ints classes
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni-website.git
commit b8da6d974247e76fa63e100ee46cce8de45a0d64
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Sat Jan 2 23:28:08 2021 -0800
Add unsigned ints classes
---
tutorials/own-uints-class.md | 23 +++++++++++++++++++++++
tutorials/uints-operations.md | 1 +
2 files changed, 24 insertions(+)
diff --git a/tutorials/own-uints-class.md b/tutorials/own-uints-class.md
new file mode 100644
index 0000000..12e0279
--- /dev/null
+++ b/tutorials/own-uints-class.md
@@ -0,0 +1,23 @@
+---
+layout: tutorial
+title: Creating your own unsigned integer class
+description: Creating your own unsigned integer class
+group: nav-right
+categories: ["units", "bigints"]
+previous: uint-operations.md
+---
+
+You can create your own domain class based off the `Uints`. A good example is the [`Wei class`](/docs/org.apache.tuweni.units.ethereum/-wei/index.html).
+
+You will need to provide the super constructor the constructor of your class.
+
+{%highlight java%}
+public final class Wei extends BaseUInt256Value<Wei> {
+...
+ private Wei(UInt256 bytes) {
+ super(bytes, Wei::new);
+ }
+...
+}
+{%endhighlight%}
+
diff --git a/tutorials/uints-operations.md b/tutorials/uints-operations.md
index 4180c6a..7498124 100644
--- a/tutorials/uints-operations.md
+++ b/tutorials/uints-operations.md
@@ -5,6 +5,7 @@ description: Unsigned Integers operations
group: nav-right
categories: ["units", "bigints"]
previous: creating-uints.md
+next: own-uints-class.md
---
`Uints` are immutable, so all operations create a new object as the result of the operation.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org