Skip to content

Commit 46c1e7e

Browse files
committed
Apply comments
1 parent 9ac2675 commit 46c1e7e

File tree

1 file changed

+96
-125
lines changed

1 file changed

+96
-125
lines changed

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java

Lines changed: 96 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import javax.cache.event.EventType;
2121
import org.apache.ignite.IgniteCheckedException;
22+
import org.apache.ignite.internal.GridCodegenConverter;
2223
import org.apache.ignite.internal.Order;
2324
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
2425
import 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,45 @@ 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.
238-
*/
239-
public KeyCacheObject keyObject() {
240-
return isFiltered() ? null : key;
241-
}
242-
243-
/**
244-
* @param newVal New value object.
201+
* @param flags Flags.
245202
*/
246-
public void newValueObject(CacheObject newVal) {
247-
this.newVal = newVal;
203+
public void flags(byte flags) {
204+
this.flags = flags;
248205
}
249206

250207
/**
251-
* @return New value object.
208+
* @return Topology version if applicable.
252209
*/
253-
public CacheObject newValueObject() {
254-
return isFiltered() ? null : newVal;
210+
@Nullable AffinityTopologyVersion topologyVersion() {
211+
return topVer;
255212
}
256213

257214
/**
258-
* @param oldVal Old value object.
215+
* @return Cache ID.
259216
*/
260-
public void oldValueObject(CacheObject oldVal) {
261-
this.oldVal = oldVal;
217+
int cacheId() {
218+
return cacheId;
262219
}
263220

264221
/**
265-
* @return Old value object.
222+
* @param cacheId Cache ID.
266223
*/
267-
public CacheObject oldValueObject() {
268-
return isFiltered() ? null : oldVal;
224+
void cacheId(int cacheId) {
225+
this.cacheId = cacheId;
269226
}
270227

271228
/**
272-
* @param part Partition.
229+
* @return Event type.
273230
*/
274-
public void part(int part) {
275-
this.part = part;
231+
EventType eventType() {
232+
return evtType;
276233
}
277234

278235
/**
279-
* @return Partition.
236+
* @param evtType Event type.
280237
*/
281-
public int part() {
282-
return part;
238+
void eventType(EventType evtType) {
239+
this.evtType = evtType;
283240
}
284241

285242
/**
@@ -290,38 +247,24 @@ int partition() {
290247
}
291248

292249
/**
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.
250+
* @param part Partition.
308251
*/
309-
public void updateCntr(long updateCntr) {
310-
this.updateCntr = updateCntr;
252+
void partition(int part) {
253+
this.part = part;
311254
}
312255

313256
/**
314257
* @return Update counter.
315258
*/
316-
public long updateCntr() {
259+
long updateCounter() {
317260
return updateCntr;
318261
}
319262

320263
/**
321-
* @return Update counter.
264+
* @param updateCntr Update counter.
322265
*/
323-
long updateCounter() {
324-
return updateCntr;
266+
void updateCounter(long updateCntr) {
267+
this.updateCntr = updateCntr;
325268
}
326269

327270
/**
@@ -339,6 +282,13 @@ void markFiltered() {
339282
depInfo = null;
340283
}
341284

285+
/**
286+
* @param topVer Topology version.
287+
*/
288+
void topologyVersion(AffinityTopologyVersion topVer) {
289+
this.topVer = topVer;
290+
}
291+
342292
/**
343293
* @param filteredCnt Number of entries filtered before this entry.
344294
*/
@@ -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

Comments
 (0)