1919
2020import javax .cache .event .EventType ;
2121import org .apache .ignite .IgniteCheckedException ;
22+ import org .apache .ignite .internal .GridCodegenConverter ;
2223import org .apache .ignite .internal .Order ;
2324import org .apache .ignite .internal .managers .deployment .GridDeploymentInfo ;
2425import org .apache .ignite .internal .processors .affinity .AffinityTopologyVersion ;
@@ -45,53 +46,72 @@ public class CacheContinuousQueryEntry implements GridCacheDeployable, Message {
4546 /** */
4647 private static final byte KEEP_BINARY = 0b0100;
4748
48- /** Cache name. */
49- @ Order (0 )
50- private int cacheId ;
51-
5249 /** */
53- @ Order (value = 1 , method = "eventType" )
54- private EventType evtType ;
50+ private static final EventType [] EVT_TYPE_VALS = EventType .values ();
5551
56- /** */
57- @ Order (2 )
58- private long filteredCnt ;
52+ /**
53+ * @param ord Event type ordinal value.
54+ * @return Event type.
55+ */
56+ @ Nullable public static EventType eventTypeFromOrdinal (int ord ) {
57+ return ord >= 0 && ord < EVT_TYPE_VALS .length ? EVT_TYPE_VALS [ord ] : null ;
58+ }
5959
60- /** Flags. */
61- @ Order (3 )
62- private byte flags ;
60+ /** */
61+ @ Order (value = 0 , method = "eventType" )
62+ @ GridCodegenConverter (
63+ type = byte .class ,
64+ get = "evtType != null ? (byte)evtType.ordinal() : -1" ,
65+ set = "eventTypeFromOrdinal($val$)"
66+ )
67+ private EventType evtType ;
6368
6469 /** Key. */
6570 @ GridToStringInclude
66- @ Order (value = 4 , method = "keyObject" )
71+ @ Order (1 )
72+ @ GridCodegenConverter (get = "isFiltered() ? null : key" )
6773 private KeyCacheObject key ;
6874
6975 /** New value. */
7076 @ GridToStringInclude
71- @ Order (value = 5 , method = "newValueObject" )
77+ @ Order (value = 2 , method = "newValue" )
78+ @ GridCodegenConverter (get = "isFiltered() ? null : newVal" )
7279 private CacheObject newVal ;
7380
7481 /** Old value. */
7582 @ GridToStringInclude
76- @ Order (value = 6 , method = "oldValueObject" )
83+ @ Order (value = 3 , method = "oldValue" )
84+ @ GridCodegenConverter (get = "isFiltered() ? null : oldVal" )
7785 private CacheObject oldVal ;
7886
87+ /** Cache name. */
88+ @ Order (4 )
89+ private int cacheId ;
90+
91+ /** Deployment info. */
92+ @ GridToStringExclude
93+ private GridDeploymentInfo depInfo ;
94+
7995 /** Partition. */
80- @ Order (7 )
96+ @ Order (value = 5 , method = "partition" )
8197 private int part ;
8298
99+ /** Update counter. */
100+ @ Order (value = 6 , method = "updateCounter" )
101+ private long updateCntr ;
102+
103+ /** Flags. */
104+ @ Order (7 )
105+ private byte flags ;
106+
83107 /** */
84108 @ GridToStringInclude
85109 @ Order (value = 8 , method = "topologyVersion" )
86110 private AffinityTopologyVersion topVer ;
87111
88- /** Update counter. */
89- @ Order (9 )
90- private long updateCntr ;
91-
92- /** Deployment info. */
93- @ GridToStringExclude
94- private GridDeploymentInfo depInfo ;
112+ /** */
113+ @ Order (value = 9 , method = "filteredCount" )
114+ private long filteredCnt ;
95115
96116 /**
97117 * Empty constructor.
@@ -170,55 +190,6 @@ public static CacheContinuousQueryEntry createFilteredEntry(
170190 return e ;
171191 }
172192
173- /**
174- * @param cacheId Cache ID.
175- */
176- public void cacheId (int cacheId ) {
177- this .cacheId = cacheId ;
178- }
179-
180- /**
181- * @return Cache ID.
182- */
183- public int cacheId () {
184- return cacheId ;
185- }
186-
187- /**
188- * @param evtType Event type.
189- */
190- public void eventType (EventType evtType ) {
191- this .evtType = evtType ;
192- }
193-
194- /**
195- * @return Event type.
196- */
197- public EventType eventType () {
198- return evtType ;
199- }
200-
201- /**
202- * @param filteredCnt Filtered count.
203- */
204- public void filteredCnt (long filteredCnt ) {
205- this .filteredCnt = filteredCnt ;
206- }
207-
208- /**
209- * @return Filtered count.
210- */
211- public long filteredCnt () {
212- return filteredCnt ;
213- }
214-
215- /**
216- * @param flags Flags.
217- */
218- public void flags (byte flags ) {
219- this .flags = flags ;
220- }
221-
222193 /**
223194 * @return Flags.
224195 */
@@ -227,59 +198,52 @@ public byte flags() {
227198 }
228199
229200 /**
230- * @param key Key object.
231- */
232- public void keyObject (KeyCacheObject key ) {
233- this .key = key ;
234- }
235-
236- /**
237- * @return Key object.
201+ * @param flags Flags.
238202 */
239- public KeyCacheObject keyObject ( ) {
240- return isFiltered () ? null : key ;
203+ public void flags ( byte flags ) {
204+ this . flags = flags ;
241205 }
242206
243207 /**
244- * @param newVal New value object .
208+ * @return Topology version if applicable .
245209 */
246- public void newValueObject ( CacheObject newVal ) {
247- this . newVal = newVal ;
210+ @ Nullable AffinityTopologyVersion topologyVersion ( ) {
211+ return topVer ;
248212 }
249213
250214 /**
251- * @return New value object .
215+ * @param topVer Topology version .
252216 */
253- public CacheObject newValueObject ( ) {
254- return isFiltered () ? null : newVal ;
217+ void topologyVersion ( AffinityTopologyVersion topVer ) {
218+ this . topVer = topVer ;
255219 }
256220
257221 /**
258- * @param oldVal Old value object .
222+ * @return Cache ID .
259223 */
260- public void oldValueObject ( CacheObject oldVal ) {
261- this . oldVal = oldVal ;
224+ int cacheId ( ) {
225+ return cacheId ;
262226 }
263227
264228 /**
265- * @return Old value object .
229+ * @param cacheId Cache ID .
266230 */
267- public CacheObject oldValueObject ( ) {
268- return isFiltered () ? null : oldVal ;
231+ void cacheId ( int cacheId ) {
232+ this . cacheId = cacheId ;
269233 }
270234
271235 /**
272- * @param part Partition .
236+ * @return Event type .
273237 */
274- public void part ( int part ) {
275- this . part = part ;
238+ EventType eventType ( ) {
239+ return evtType ;
276240 }
277241
278242 /**
279- * @return Partition .
243+ * @param evtType Event type .
280244 */
281- public int part ( ) {
282- return part ;
245+ void eventType ( EventType evtType ) {
246+ this . evtType = evtType ;
283247 }
284248
285249 /**
@@ -290,38 +254,24 @@ int partition() {
290254 }
291255
292256 /**
293- * @param topVer Topology version.
294- */
295- public void topologyVersion (AffinityTopologyVersion topVer ) {
296- this .topVer = topVer ;
297- }
298-
299- /**
300- * @return Topology version if applicable.
301- */
302- @ Nullable public AffinityTopologyVersion topologyVersion () {
303- return topVer ;
304- }
305-
306- /**
307- * @param updateCntr Update counter.
257+ * @param part Partition.
308258 */
309- public void updateCntr ( long updateCntr ) {
310- this .updateCntr = updateCntr ;
259+ void partition ( int part ) {
260+ this .part = part ;
311261 }
312262
313263 /**
314264 * @return Update counter.
315265 */
316- public long updateCntr () {
266+ long updateCounter () {
317267 return updateCntr ;
318268 }
319269
320270 /**
321- * @return Update counter.
271+ * @param updateCntr Update counter.
322272 */
323- long updateCounter () {
324- return updateCntr ;
273+ void updateCounter (long updateCntr ) {
274+ this . updateCntr = updateCntr ;
325275 }
326276
327277 /**
@@ -437,20 +387,41 @@ KeyCacheObject key() {
437387 return key ;
438388 }
439389
390+ /**
391+ * @param key Key.
392+ */
393+ void key (KeyCacheObject key ) {
394+ this .key = key ;
395+ }
396+
440397 /**
441398 * @return New value.
442399 */
443400 CacheObject newValue () {
444401 return newVal ;
445402 }
446403
404+ /**
405+ * @param newVal New value.
406+ */
407+ void newValue (CacheObject newVal ) {
408+ this .newVal = newVal ;
409+ }
410+
447411 /**
448412 * @return Old value.
449413 */
450414 CacheObject oldValue () {
451415 return oldVal ;
452416 }
453417
418+ /**
419+ * @param oldVal Old value.
420+ */
421+ void oldValue (CacheObject oldVal ) {
422+ this .oldVal = oldVal ;
423+ }
424+
454425 /** {@inheritDoc} */
455426 @ Override public void prepare (GridDeploymentInfo depInfo ) {
456427 this .depInfo = depInfo ;
0 commit comments