1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
15 * The description can be at most 639 __bytes__ long
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class Description extends CommonBase {
19 Description(Object _dummy, long ptr) { super(ptr); }
20 @Override @SuppressWarnings("deprecation")
21 protected void finalize() throws Throwable {
23 if (ptr != 0) { bindings.Description_free(ptr); }
27 long ret = bindings.Description_clone_ptr(this.ptr);
28 Reference.reachabilityFence(this);
33 * Creates a copy of the Description
35 public Description clone() {
36 long ret = bindings.Description_clone(this.ptr);
37 Reference.reachabilityFence(this);
38 if (ret >= 0 && ret <= 4096) { return null; }
39 org.ldk.structs.Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Description(null, ret); }
40 ret_hu_conv.ptrs_to.add(this);
45 * Checks if two Descriptions contain equal inner contents.
48 long ret = bindings.Description_hash(this.ptr);
49 Reference.reachabilityFence(this);
53 @Override public int hashCode() {
54 return (int)this.hash();
57 * Checks if two Descriptions contain equal inner contents.
58 * This ignores pointers and is_owned flags and looks at the values in fields.
59 * Two objects with NULL inner values will be considered "equal" here.
61 public boolean eq(Description b) {
62 boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
63 Reference.reachabilityFence(this);
64 Reference.reachabilityFence(b);
69 @Override public boolean equals(Object o) {
70 if (!(o instanceof Description)) return false;
71 return this.eq((Description)o);
74 * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
75 * returns `CreationError::DescriptionTooLong` otherwise
77 * Please note that single characters may use more than one byte due to UTF8 encoding.
79 public static Result_DescriptionCreationErrorZ of(java.lang.String description) {
80 long ret = bindings.Description_new(description);
81 Reference.reachabilityFence(description);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret);
88 * Returns the underlying description `String`
90 public String into_inner() {
91 String ret = bindings.Description_into_inner(this.ptr);
92 Reference.reachabilityFence(this);