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