Updated bindings
[ldk-java] / src / main / java / org / ldk / structs / UserConfig.java
index 0b1b072f06b1d89e90c6f904e72d23df6911d536..8e871e21f71f8a4c965f95ec75c17bdb75cad8fe 100644 (file)
@@ -2,64 +2,70 @@ package org.ldk.structs;
 
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
 
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class UserConfig extends CommonBase {
        UserConfig(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UserConfig_free(ptr); super.finalize();
+               super.finalize();
+               if (ptr != 0) { bindings.UserConfig_free(ptr); }
        }
 
-       public UserConfig(UserConfig orig) {
-               super(bindings.UserConfig_clone(orig.ptr & ~1));
-               this.ptrs_to.add(orig);
+       public UserConfig clone() {
+               long ret = bindings.UserConfig_clone(this.ptr);
+               UserConfig ret_hu_conv = new UserConfig(null, ret);
+               return ret_hu_conv;
        }
 
-       public ChannelHandshakeConfig get_own_channel_config(UserConfig this_ptr) {
-               ChannelHandshakeConfig ret = new ChannelHandshakeConfig(null, bindings.UserConfig_get_own_channel_config(this_ptr.ptr & ~1));
-               this.ptrs_to.add(this_ptr);
-               return ret;
+       public ChannelHandshakeConfig get_own_channel_config() {
+               long ret = bindings.UserConfig_get_own_channel_config(this.ptr);
+               ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
+               return ret_hu_conv;
        }
 
-       public void set_own_channel_config(UserConfig this_ptr, ChannelHandshakeConfig val) {
-               bindings.UserConfig_set_own_channel_config(this_ptr.ptr & ~1, val.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       public void set_own_channel_config(ChannelHandshakeConfig val) {
+               bindings.UserConfig_set_own_channel_config(this.ptr, val == null ? 0 : val.ptr & ~1);
                this.ptrs_to.add(val);
        }
 
-       public ChannelHandshakeLimits get_peer_channel_config_limits(UserConfig this_ptr) {
-               ChannelHandshakeLimits ret = new ChannelHandshakeLimits(null, bindings.UserConfig_get_peer_channel_config_limits(this_ptr.ptr & ~1));
-               this.ptrs_to.add(this_ptr);
-               return ret;
+       public ChannelHandshakeLimits get_peer_channel_config_limits() {
+               long ret = bindings.UserConfig_get_peer_channel_config_limits(this.ptr);
+               ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
+               return ret_hu_conv;
        }
 
-       public void set_peer_channel_config_limits(UserConfig this_ptr, ChannelHandshakeLimits val) {
-               bindings.UserConfig_set_peer_channel_config_limits(this_ptr.ptr & ~1, val.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       public void set_peer_channel_config_limits(ChannelHandshakeLimits val) {
+               bindings.UserConfig_set_peer_channel_config_limits(this.ptr, val == null ? 0 : val.ptr & ~1);
                this.ptrs_to.add(val);
        }
 
-       public ChannelConfig get_channel_options(UserConfig this_ptr) {
-               ChannelConfig ret = new ChannelConfig(null, bindings.UserConfig_get_channel_options(this_ptr.ptr & ~1));
-               this.ptrs_to.add(this_ptr);
-               return ret;
+       public ChannelConfig get_channel_options() {
+               long ret = bindings.UserConfig_get_channel_options(this.ptr);
+               ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
+               return ret_hu_conv;
        }
 
-       public void set_channel_options(UserConfig this_ptr, ChannelConfig val) {
-               bindings.UserConfig_set_channel_options(this_ptr.ptr & ~1, val.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       public void set_channel_options(ChannelConfig val) {
+               bindings.UserConfig_set_channel_options(this.ptr, val == null ? 0 : val.ptr & ~1);
                this.ptrs_to.add(val);
        }
 
-       public UserConfig(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg) {
-               super(bindings.UserConfig_new(own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg.ptr & ~1, channel_options_arg.ptr & ~1));
-               this.ptrs_to.add(own_channel_config_arg);
-               this.ptrs_to.add(peer_channel_config_limits_arg);
-               this.ptrs_to.add(channel_options_arg);
+       public static UserConfig constructor_new(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg) {
+               long ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1);
+               UserConfig ret_hu_conv = new UserConfig(null, ret);
+               ret_hu_conv.ptrs_to.add(own_channel_config_arg);
+               ret_hu_conv.ptrs_to.add(peer_channel_config_limits_arg);
+               ret_hu_conv.ptrs_to.add(channel_options_arg);
+               return ret_hu_conv;
        }
 
-       public UserConfig() {
-               super(bindings.UserConfig_default());
+       public static UserConfig constructor_default() {
+               long ret = bindings.UserConfig_default();
+               UserConfig ret_hu_conv = new UserConfig(null, ret);
+               return ret_hu_conv;
        }
 
 }