41 private final long nativeRef;
42 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
44 private CppProxy(
long nativeRef)
46 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
47 this.nativeRef = nativeRef;
50 private native
void nativeDestroy(
long nativeRef);
51 public void _djinni_private_destroy()
53 boolean destroyed = this.destroyed.getAndSet(
true);
54 if (!destroyed) nativeDestroy(this.nativeRef);
56 protected void finalize() throws
java.lang.Throwable
58 _djinni_private_destroy();
67 assert !this.destroyed.get() :
"trying to use a destroyed object";
68 return native_getId(this.nativeRef);
70 private native
int native_getId(
long _nativeRef);
73 public String getTitle()
75 assert !this.destroyed.get() :
"trying to use a destroyed object";
76 return native_getTitle(this.nativeRef);
78 private native String native_getTitle(
long _nativeRef);
81 public String getContent()
83 assert !this.destroyed.get() :
"trying to use a destroyed object";
84 return native_getContent(this.nativeRef);
86 private native String native_getContent(
long _nativeRef);
89 public String getImageUrl()
91 assert !this.destroyed.get() :
"trying to use a destroyed object";
92 return native_getImageUrl(this.nativeRef);
94 private native String native_getImageUrl(
long _nativeRef);