1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
14 * The description can be at most 639 __bytes__ long
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 {
22 if (ptr != 0) { bindings.Description_free(ptr); }
26 * Checks if two Descriptions contain equal inner contents.
27 * This ignores pointers and is_owned flags and looks at the values in fields.
28 * Two objects with NULL inner values will be considered "equal" here.
30 public boolean eq(Description b) {
31 boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
37 * Creates a copy of the Description
39 public Description clone() {
40 long ret = bindings.Description_clone(this.ptr);
41 if (ret < 1024) { return null; }
42 Description ret_hu_conv = new Description(null, ret);
43 ret_hu_conv.ptrs_to.add(this);
48 * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
49 * returns `CreationError::DescriptionTooLong` otherwise
51 * Please note that single characters may use more than one byte due to UTF8 encoding.
53 public static Result_DescriptionCreationErrorZ of(java.lang.String description) {
54 long ret = bindings.Description_new(description);
55 if (ret < 1024) { return null; }
56 Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret);
61 * Returns the underlying description `String`
63 public String into_inner() {
64 String ret = bindings.Description_into_inner(this.ptr);
65 this.ptrs_to.add(this);