154 private static final class CppProxy
extends MapObject
156 private final long nativeRef;
157 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
159 private CppProxy(
long nativeRef)
161 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
162 this.nativeRef = nativeRef;
165 private native
void nativeDestroy(
long nativeRef);
166 public void _djinni_private_destroy()
168 boolean destroyed = this.destroyed.getAndSet(
true);
169 if (!destroyed) nativeDestroy(this.nativeRef);
171 protected void finalize() throws
java.lang.Throwable
173 _djinni_private_destroy();
182 assert !this.destroyed.get() :
"trying to use a destroyed object";
183 return native_getId(this.nativeRef);
185 private native
int native_getId(
long _nativeRef);
190 assert !this.destroyed.get() :
"trying to use a destroyed object";
191 return native_getType(this.nativeRef);
193 private native
MapObjectType native_getType(
long _nativeRef);
196 public byte[] getData()
198 assert !this.destroyed.get() :
"trying to use a destroyed object";
199 return native_getData(this.nativeRef);
201 private native
byte[] native_getData(
long _nativeRef);
204 public boolean setVisible(
boolean visible)
206 assert !this.destroyed.get() :
"trying to use a destroyed object";
207 return native_setVisible(this.nativeRef, visible);
209 private native
boolean native_setVisible(
long _nativeRef,
boolean visible);
212 public boolean setInteractive(
boolean interactive)
214 assert !this.destroyed.get() :
"trying to use a destroyed object";
215 return native_setInteractive(this.nativeRef, interactive);
217 private native
boolean native_setInteractive(
long _nativeRef,
boolean interactive);
220 public void setData(
byte[] data)
222 assert !this.destroyed.get() :
"trying to use a destroyed object";
223 native_setData(this.nativeRef, data);
225 private native
void native_setData(
long _nativeRef,
byte[] data);
228 public boolean setTitle(String title)
230 assert !this.destroyed.get() :
"trying to use a destroyed object";
231 return native_setTitle(this.nativeRef, title);
233 private native
boolean native_setTitle(
long _nativeRef, String title);
236 public boolean setAlpha(
float alpha)
238 assert !this.destroyed.get() :
"trying to use a destroyed object";
239 return native_setAlpha(this.nativeRef, alpha);
241 private native
boolean native_setAlpha(
long _nativeRef,
float alpha);