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 {
31 public abstract int getId();
32
45 public abstract String getTitle();
46
59 public abstract String getContent();
60
73 public abstract String getImageUrl();
74
75 private static final class CppProxy extends Notification
76 {
77 private final long nativeRef;
78 private final AtomicBoolean destroyed = new AtomicBoolean(false);
79
80 private CppProxy(long nativeRef)
81 {
82 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
83 this.nativeRef = nativeRef;
84 }
85
86 private native void nativeDestroy(long nativeRef);
87 public void _djinni_private_destroy()
88 {
89 boolean destroyed = this.destroyed.getAndSet(true);
90 if (!destroyed) nativeDestroy(this.nativeRef);
91 }
92 protected void finalize() throws java.lang.Throwable
93 {
94 _djinni_private_destroy();
95 super.finalize();
96 }
97
98 // Notification methods
99
100 @Override
101 public int getId()
102 {
103 assert !this.destroyed.get() : "trying to use a destroyed object";
104 return native_getId(this.nativeRef);
105 }
106 private native int native_getId(long _nativeRef);
107
108 @Override
109 public String getTitle()
110 {
111 assert !this.destroyed.get() : "trying to use a destroyed object";
112 return native_getTitle(this.nativeRef);
113 }
114 private native String native_getTitle(long _nativeRef);
115
116 @Override
117 public String getContent()
118 {
119 assert !this.destroyed.get() : "trying to use a destroyed object";
120 return native_getContent(this.nativeRef);
121 }
122 private native String native_getContent(long _nativeRef);
123
124 @Override
125 public String getImageUrl()
126 {
127 assert !this.destroyed.get() : "trying to use a destroyed object";
128 return native_getImageUrl(this.nativeRef);
129 }
130 private native String native_getImageUrl(long _nativeRef);
131 }
132}