Update auto-updated Java files
[ldk-java] / ts / structs / LockableScore.ts
index 8eef837f7f386aef2fb6d51da02ed65d78a8b7aa..bc44054d985a66111de2711cdca79d5d43534fa4 100644 (file)
@@ -5,30 +5,59 @@ import * as bindings from '../bindings' // TODO: figure out location
 
 
 
-            export default class LockableScore extends CommonBase {
-                constructor(_dummy: object, ptr: number) {
-                    super(ptr);
+            export class LockableScore extends CommonBase {
+
+                bindings_instance?: bindings.LDKLockableScore;
+
+                constructor(ptr?: number, arg?: bindings.LDKLockableScore) {
+                    if (Number.isFinite(ptr)) {
+                                       super(ptr);
+                                       this.bindings_instance = null;
+                                   } else {
+                                       // TODO: private constructor instantiation
+                                       super(bindings.LDKLockableScore_new(arg));
+                                       this.ptrs_to.push(arg);
+                                       
+                                   }
                 }
 
-                
                 protected finalize() {
-                    super.finalize();
-
                     if (this.ptr != 0) {
                         bindings.LockableScore_free(this.ptr);
                     }
+                    super.finalize();
                 }
-       public static LockableScore constructor_new(Score score) {
-               number ret = bindings.LockableScore_new(score == null ? 0 : score.ptr);
-               const ret_hu_conv: LockableScore = new LockableScore(null, ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(score);
-               return ret_hu_conv;
-       }
 
-       public Uint8Array write() {
-               Uint8Array ret = bindings.LockableScore_write(this.ptr);
-               return ret;
+                static new_impl(arg: LockableScoreInterface): LockableScore {
+                    const impl_holder: LDKLockableScoreHolder = new LDKLockableScoreHolder();
+                    let structImplementation = <bindings.LDKLockableScore>{
+                        // todo: in-line interface filling
+                        lock (): number {
+                                                       Score ret = arg.lock();
+                               result: number = ret == null ? 0 : ret.ptr;
+                               impl_holder.held.ptrs_to.add(ret);
+                               return result;
+                                               },
+
+                                               
+                    };
+                    impl_holder.held = new LockableScore (null, structImplementation);
+                }
+            }
+
+            export interface LockableScoreInterface {
+                lock(): Score;
+                               
+            }
+
+            class LDKLockableScoreHolder {
+                held: LockableScore;
+            }
+       public Score lock() {
+               number ret = bindings.LockableScore_lock(this.ptr);
+               Score ret_hu_conv = new Score(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
 }