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 {
32 public abstract LocationPoint getPoint();
33
47 public abstract MapObject getMapObject();
48
49 private static final class CppProxy extends MapObjectPickResult
50 {
51 private final long nativeRef;
52 private final AtomicBoolean destroyed = new AtomicBoolean(false);
53
54 private CppProxy(long nativeRef)
55 {
56 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
57 this.nativeRef = nativeRef;
58 }
59
60 private native void nativeDestroy(long nativeRef);
61 public void _djinni_private_destroy()
62 {
63 boolean destroyed = this.destroyed.getAndSet(true);
64 if (!destroyed) nativeDestroy(this.nativeRef);
65 }
66 protected void finalize() throws java.lang.Throwable
67 {
68 _djinni_private_destroy();
69 super.finalize();
70 }
71
72 // MapObjectPickResult methods
73
74 @Override
75 public LocationPoint getPoint()
76 {
77 assert !this.destroyed.get() : "trying to use a destroyed object";
78 return native_getPoint(this.nativeRef);
79 }
80 private native LocationPoint native_getPoint(long _nativeRef);
81
82 @Override
83 public MapObject getMapObject()
84 {
85 assert !this.destroyed.get() : "trying to use a destroyed object";
86 return native_getMapObject(this.nativeRef);
87 }
88 private native MapObject native_getMapObject(long _nativeRef);
89 }
90}