| |
| |
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <title>Creating your own unsigned integer class</title> |
| <link rel="icon" |
| type="image/ico" |
| href="/assets/themes/apache/img/tuweni_face.ico"> |
| <meta name="description" content="Creating your own unsigned integer class"> |
| |
| <meta name="author" content=""> |
| |
| <!-- Enable responsive viewport --> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
| <!--[if lt IE 9]> |
| <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
| <![endif]--> |
| |
| <!-- Le styles --> |
| <link href="/assets/themes/apache/bootstrap/css/bootstrap.css" rel="stylesheet"> |
| <link href="/assets/themes/apache/css/style.css?body=1" rel="stylesheet" type="text/css"> |
| <link href="/css/main.css?body=1" rel="stylesheet" type="text/css"> |
| <link href="/assets/themes/apache/css/syntax.css" rel="stylesheet" type="text/css" media="screen" /> |
| <!-- Le fav and touch icons --> |
| <!-- Update these with your own images |
| <link rel="shortcut icon" href="images/favicon.ico"> |
| <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> |
| <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png"> |
| <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png"> |
| --> |
| <script src="/assets/themes/apache/jquery/jquery-2.1.1.min.js"></script> |
| |
| </head> |
| |
| <body> |
| |
| <nav class="navbar-inverse"> |
| <div class="container-fluid"> |
| <!-- Brand and toggle get grouped for better mobile display --> |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a class="navbar-brand" href="/" style="font-family: 'Montserrat Light'"> |
| <img src="/assets/themes/apache/img/tuweni_face.svg" width="25" height="25"> |
| Apache Tuweni |
| </a> |
| </div> |
| |
| <!-- Collect the nav links, forms, and other content for toggling --> |
| <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
| <ul class="nav navbar-nav navbar-right"> |
| <li id="download"> |
| <a href="/download">Download</a> |
| </li> |
| <li id="community"> |
| <a href="#" data-toggle="dropdown" class="dropdown-toggle">Community<b class="caret"></b></a> |
| <ul class="dropdown-menu dropdown-left"> |
| <li><a href="/community">Get Involved</a></li> |
| <li><a href="/community-members">Who we are</a></li> |
| </ul> |
| </li> |
| <li id="docs"> |
| <a href="#" data-toggle="dropdown" class="dropdown-toggle">Docs<b class="caret"></b></a> |
| <ul class="dropdown-menu dropdown-left"> |
| <li><a href="/tutorials">Tutorials</a></li> |
| <li><a href="/faq">FAQ</a></li> |
| <li><a href="/docs">Javadoc</a></li> |
| </ul> |
| </li> |
| <li><a href="https://github.com/apache/incubator-tuweni">GitHub</a></li> |
| <li id="apache"> |
| <a href="#" data-toggle="dropdown" class="dropdown-toggle">Apache<b class="caret"></b></a> |
| <ul class="dropdown-menu"> |
| <li><a href="https://www.apache.org/foundation/how-it-works.html">Apache Software Foundation</a></li> |
| <li><a href="https://www.apache.org/licenses/">License</a></li> |
| <li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> |
| <li><a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a></li> |
| <li><a href="https://www.apache.org/security/">Security</a></li> |
| <li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div><!-- /.navbar-collapse --> |
| </div><!-- /.container-fluid --> |
| </nav> |
| |
| |
| |
| |
| <div class="container" style="margin-top:10px"> |
| |
| |
| <div class="page-header"> |
| <h1>Creating your own unsigned integer class </h1> |
| </div> |
| |
| <div class="row-fluid post-full"> |
| <div class="span12"> |
| |
| |
| <ul class="tag_box inline"> |
| <li><i class="icon-folder-open"></i></li> |
| |
| |
| |
| |
| |
| |
| <li><a href="#units-ref"> |
| units <span></span> |
| </a></li> |
| |
| <li><a href="#bigints-ref"> |
| bigints <span></span> |
| </a></li> |
| |
| |
| |
| |
| </ul> |
| |
| |
| |
| <ul class="tag_box inline"> |
| <li><i class="icon-tags"></i></li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </ul> |
| |
| |
| <div class="pagination row col-md-12"> |
| <div class="col-md-6"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </div> |
| <div class="col-md-6" style="text-align: right;"> |
| |
| </div> |
| </div> |
| <hr> |
| <div class="date"> |
| <span></span> |
| </div> |
| <div class="content"> |
| <p>You can create your own domain class based off the <code class="highlighter-rouge">Uints</code>. A good example is the <a href="/docs/org.apache.tuweni.units.ethereum/-wei/index.html"><code class="highlighter-rouge">Wei class</code></a>.</p> |
| |
| <p>You will need to provide the super constructor the constructor of your class.</p> |
| |
| <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="nc">Wei</span> <span class="kd">extends</span> <span class="n">BaseUInt256Value</span><span class="o"><</span><span class="n">Wei</span><span class="o">></span> <span class="o">{</span> |
| <span class="o">...</span> |
| <span class="kd">private</span> <span class="nf">Wei</span><span class="o">(</span><span class="n">UInt256</span> <span class="n">bytes</span><span class="o">)</span> <span class="o">{</span> |
| <span class="kd">super</span><span class="o">(</span><span class="n">bytes</span><span class="o">,</span> <span class="nl">Wei:</span><span class="o">:</span><span class="k">new</span><span class="o">);</span> |
| <span class="o">}</span> |
| <span class="o">...</span> |
| <span class="o">}</span></code></pre></figure> |
| |
| |
| </div> |
| <div class="pagination row col-md-12"> |
| <div class="col-md-6"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </div> |
| <div class="col-md-6" style="text-align: right;"> |
| |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| |
| |
| <hr> |
| <footer> |
| <!-- <p>© 2022 </p>--> |
| <footer class="site-footer"> |
| <div class="wrapper"> |
| <div class="footer-col-wrapper"> |
| |
| Apache Tuweni is an effort undergoing <a href="https://incubator.apache.org/index.html">Incubation</a> |
| at The Apache Software Foundation (ASF), sponsored by the Incubator. Incubation is required of all newly |
| accepted projects until a further review indicates that the infrastructure, communications, and decision |
| making process have stabilized in a manner consistent with other successful ASF projects. While incubation |
| status is not necessarily a reflection of the completeness or stability of the code, it does indicate that |
| the project has yet to be fully endorsed by the ASF. |
| <hr> |
| |
| <div style="text-align:center;"> |
| |
| <div style="margin-top: 20px; margin-bottom: 20px;"> |
| <a href="http://incubator.apache.org"><img src="/assets/themes/apache/img/egg-logo.png" |
| alt="Apache Incubator"/></a> |
| </div> |
| |
| <div> |
| Copyright © 2019-2022 <a href="http://www.apache.org">The Apache Software Foundation</a>. |
| <br> |
| Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version |
| 2.0</a>. |
| <br> |
| |
| Apache, the Apache Feather logo, and the Apache Incubator project logo are trademarks of The Apache |
| Software Foundation. |
| |
| </div> |
| </div> |
| </div> |
| </div> |
| </footer> |
| |
| </footer> |
| </div> |
| |
| |
| |
| |
| <script src="/assets/themes/apache/bootstrap/js/bootstrap.min.js"></script> |
| |
| |
| </body> |
| </html> |
| |