Loading...
Searching...
No Matches
Notification.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class Notification {
22 public abstract int getId();
23
27 public abstract String getTitle();
28
32 public abstract String getContent();
33
37 public abstract String getImageUrl();
38
39 private static final class CppProxy extends Notification
40 {
41 private final long nativeRef;
42 private final AtomicBoolean destroyed = new AtomicBoolean(false);
43
44 private CppProxy(long nativeRef)
45 {
46 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
47 this.nativeRef = nativeRef;
48 }
49
50 private native void nativeDestroy(long nativeRef);
51 public void _djinni_private_destroy()
52 {
53 boolean destroyed = this.destroyed.getAndSet(true);
54 if (!destroyed) nativeDestroy(this.nativeRef);
55 }
56 protected void finalize() throws java.lang.Throwable
57 {
58 _djinni_private_destroy();
59 super.finalize();
60 }
61
62 // Notification methods
63
64 @Override
65 public int getId()
66 {
67 assert !this.destroyed.get() : "trying to use a destroyed object";
68 return native_getId(this.nativeRef);
69 }
70 private native int native_getId(long _nativeRef);
71
72 @Override
73 public String getTitle()
74 {
75 assert !this.destroyed.get() : "trying to use a destroyed object";
76 return native_getTitle(this.nativeRef);
77 }
78 private native String native_getTitle(long _nativeRef);
79
80 @Override
81 public String getContent()
82 {
83 assert !this.destroyed.get() : "trying to use a destroyed object";
84 return native_getContent(this.nativeRef);
85 }
86 private native String native_getContent(long _nativeRef);
87
88 @Override
89 public String getImageUrl()
90 {
91 assert !this.destroyed.get() : "trying to use a destroyed object";
92 return native_getImageUrl(this.nativeRef);
93 }
94 private native String native_getImageUrl(long _nativeRef);
95 }
96}