Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Description.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * Description string
12  * 
13  * # Invariants
14  * The description can be at most 639 __bytes__ long
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class Description extends CommonBase {
18         Description(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.Description_free(ptr); }
23         }
24
25         long clone_ptr() {
26                 long ret = bindings.Description_clone_ptr(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * Creates a copy of the Description
32          */
33         public Description clone() {
34                 long ret = bindings.Description_clone(this.ptr);
35                 if (ret >= 0 && ret <= 4096) { return null; }
36                 Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Description(null, ret); }
37                 ret_hu_conv.ptrs_to.add(this);
38                 return ret_hu_conv;
39         }
40
41         /**
42          * Checks if two Descriptions contain equal inner contents.
43          */
44         public long hash() {
45                 long ret = bindings.Description_hash(this.ptr);
46                 return ret;
47         }
48
49         /**
50          * Checks if two Descriptions contain equal inner contents.
51          * This ignores pointers and is_owned flags and looks at the values in fields.
52          * Two objects with NULL inner values will be considered "equal" here.
53          */
54         public boolean eq(Description b) {
55                 boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
56                 this.ptrs_to.add(b);
57                 return ret;
58         }
59
60         /**
61          * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
62          * returns `CreationError::DescriptionTooLong` otherwise
63          * 
64          * Please note that single characters may use more than one byte due to UTF8 encoding.
65          */
66         public static Result_DescriptionCreationErrorZ of(java.lang.String description) {
67                 long ret = bindings.Description_new(description);
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret);
70                 return ret_hu_conv;
71         }
72
73         /**
74          * Returns the underlying description `String`
75          */
76         public String into_inner() {
77                 String ret = bindings.Description_into_inner(this.ptr);
78                 ;
79                 return ret;
80         }
81
82 }