Loading...
Searching...
No Matches
MapObjectPickResult.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class MapObjectPickResult {
24 public abstract LocationPoint getPoint();
25
31 public abstract MapObject getMapObject();
32
33 private static final class CppProxy extends MapObjectPickResult
34 {
35 private final long nativeRef;
36 private final AtomicBoolean destroyed = new AtomicBoolean(false);
37
38 private CppProxy(long nativeRef)
39 {
40 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
41 this.nativeRef = nativeRef;
42 }
43
44 private native void nativeDestroy(long nativeRef);
45 public void _djinni_private_destroy()
46 {
47 boolean destroyed = this.destroyed.getAndSet(true);
48 if (!destroyed) nativeDestroy(this.nativeRef);
49 }
50 protected void finalize() throws java.lang.Throwable
51 {
52 _djinni_private_destroy();
53 super.finalize();
54 }
55
56 // MapObjectPickResult methods
57
58 @Override
59 public LocationPoint getPoint()
60 {
61 assert !this.destroyed.get() : "trying to use a destroyed object";
62 return native_getPoint(this.nativeRef);
63 }
64 private native LocationPoint native_getPoint(long _nativeRef);
65
66 @Override
67 public MapObject getMapObject()
68 {
69 assert !this.destroyed.get() : "trying to use a destroyed object";
70 return native_getMapObject(this.nativeRef);
71 }
72 private native MapObject native_getMapObject(long _nativeRef);
73 }
74}