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