@@ -37,82 +37,126 @@ public enum TableOption implements Option {
37
37
/**
38
38
* {@code comment}
39
39
*/
40
- COMMENT ("comment" , String .class , true , true , true ),
40
+ COMMENT ("comment" , String .class , true ),
41
+
41
42
/**
42
43
* {@code COMPACT STORAGE}
43
44
*
44
45
* @deprecated since 2.2. Cassandra 4.x has deprecated compact storage.
45
46
*/
46
47
@ Deprecated
47
- COMPACT_STORAGE ("COMPACT STORAGE" , Void .class , false , false , false ),
48
+ COMPACT_STORAGE ("COMPACT STORAGE" ),
49
+
48
50
/**
49
51
* {@code compaction}. Value is a <code>Map<CompactionOption,Object></code>.
50
52
*
51
53
* @see CompactionOption
52
54
*/
53
- COMPACTION ("compaction" , Map .class , true , false , false ),
55
+ COMPACTION ("compaction" , Map .class ),
56
+
54
57
/**
55
58
* {@code compression}. Value is a <code>Map<CompressionOption,Object></code>.
56
59
*
57
60
* @see CompressionOption
58
61
*/
59
- COMPRESSION ("compression" , Map .class , true , false , false ),
62
+ COMPRESSION ("compression" , Map .class ),
63
+
60
64
/**
61
65
* {@code caching}
62
66
*
63
67
* @see CachingOption
64
68
*/
65
- CACHING ("caching" , Map .class , true , false , false ),
69
+ CACHING ("caching" , Map .class ),
70
+
66
71
/**
67
72
* {@code bloom_filter_fp_chance}
68
73
*/
69
- BLOOM_FILTER_FP_CHANCE ("bloom_filter_fp_chance" , Double .class , true , false , false ),
74
+ BLOOM_FILTER_FP_CHANCE ("bloom_filter_fp_chance" , Double .class ),
75
+
70
76
/**
71
77
* {@code read_repair_chance}
72
78
*/
73
- READ_REPAIR_CHANCE ("read_repair_chance" , Double .class , true , false , false ),
79
+ READ_REPAIR_CHANCE ("read_repair_chance" , Double .class ),
80
+
74
81
/**
75
82
* {@code dclocal_read_repair_chance}
76
83
*/
77
- DCLOCAL_READ_REPAIR_CHANCE ("dclocal_read_repair_chance" , Double .class , true , false , false ),
84
+ DCLOCAL_READ_REPAIR_CHANCE ("dclocal_read_repair_chance" , Double .class ),
85
+
78
86
/**
79
87
* {@code gc_grace_seconds}
80
88
*/
81
- GC_GRACE_SECONDS ("gc_grace_seconds" , Long .class , true , false , false ),
89
+ GC_GRACE_SECONDS ("gc_grace_seconds" , Long .class ),
90
+
82
91
/**
83
92
* {@code default_time_to_live}
93
+ *
94
+ * @since 5.0
84
95
*/
85
- DEFAULT_TIME_TO_LIVE ("default_time_to_live" , Long .class , true , false , false ),
96
+ DEFAULT_TIME_TO_LIVE ("default_time_to_live" , Long .class ),
97
+
86
98
/**
87
99
* {@code cdc}
100
+ *
101
+ * @since 5.0
88
102
*/
89
- CDC ("cdc" , Boolean .class , true , false , false ),
103
+ CDC ("cdc" , Boolean .class ),
104
+
90
105
/**
91
106
* {@code speculative_retry}
107
+ *
108
+ * @since 5.0
92
109
*/
93
- SPECULATIVE_RETRY ("speculative_retry" , String .class , true , true , true ),
110
+ SPECULATIVE_RETRY ("speculative_retry" , String .class , true ),
111
+
94
112
/**
95
113
* {@code memtable_flush_period_in_ms}
114
+ *
115
+ * @since 5.0
96
116
*/
97
- MEMTABLE_FLUSH_PERIOD_IN_MS ("memtable_flush_period_in_ms" , Long .class , true , false , false ),
117
+ MEMTABLE_FLUSH_PERIOD_IN_MS ("memtable_flush_period_in_ms" , Long .class ),
118
+
98
119
/**
99
120
* {@code crc_check_chance}
121
+ *
122
+ * @since 5.0
100
123
*/
101
- CRC_CHECK_CHANCE ("crc_check_chance" , Double .class , true , false , false ),
124
+ CRC_CHECK_CHANCE ("crc_check_chance" , Double .class ),
125
+
102
126
/**
103
127
* {@code min_index_interval}
128
+ *
129
+ * @since 5.0
104
130
*/
105
- MIN_INDEX_INTERVAL ("min_index_interval" , Long .class , true , false , false ),
131
+ MIN_INDEX_INTERVAL ("min_index_interval" , Long .class ),
132
+
106
133
/**
107
134
* {@code max_index_interval}
135
+ *
136
+ * @since 5.0
108
137
*/
109
- MAX_INDEX_INTERVAL ("max_index_interval" , Long .class , true , false , false ),
138
+ MAX_INDEX_INTERVAL ("max_index_interval" , Long .class ),
139
+
110
140
/**
111
141
* {@code read_repair}
142
+ *
143
+ * @since 5.0
112
144
*/
113
- READ_REPAIR ("read_repair" , String .class , true , true , true );
145
+ READ_REPAIR ("read_repair" , String .class , true );
146
+
147
+ private final Option delegate ;
114
148
115
- private Option delegate ;
149
+ TableOption (String name ) {
150
+ this (name , Void .class , false , false , false );
151
+ }
152
+
153
+ TableOption (String name , Class <?> type ) {
154
+ this (name , type , true , false , false );
155
+ }
156
+
157
+ TableOption (String name , Class <?> type , boolean escapeAndQuote ) {
158
+ this (name , type , true , escapeAndQuote , escapeAndQuote );
159
+ }
116
160
117
161
TableOption (String name , Class <?> type , boolean requiresValue , boolean escapesValue , boolean quotesValue ) {
118
162
this .delegate = new DefaultOption (name , type , requiresValue , escapesValue , quotesValue );
@@ -127,28 +171,31 @@ public enum TableOption implements Option {
127
171
* @since 4.1.1
128
172
*/
129
173
public static TableOption valueOfIgnoreCase (String optionName ) {
130
- for (TableOption value : values ()) {
131
- if (value .getName ().equalsIgnoreCase (optionName )) {
132
- return value ;
133
- }
174
+
175
+ TableOption tableOption = findByName (optionName );
176
+
177
+ if (tableOption != null ) {
178
+ return tableOption ;
134
179
}
180
+
135
181
throw new IllegalArgumentException (String .format ("Unable to recognize specified Table option '%s'" , optionName ));
136
182
}
137
183
138
184
/**
139
185
* Look up {@link TableOption} by name using case-insensitive lookups.
140
186
*
141
187
* @param optionName name of the option.
142
- * @return the matching {@link TableOption}, or {@code null} if no match is found
143
- * @since 4.5.2
188
+ * @return the matching {@link TableOption}, or {@literal null} if no match is found.
189
+ * @since 5.0
144
190
*/
145
- @ Nullable
146
- public static TableOption findByNameIgnoreCase ( String optionName ) {
191
+ public static @ Nullable TableOption findByName ( String optionName ) {
192
+
147
193
for (TableOption value : values ()) {
148
194
if (value .getName ().equalsIgnoreCase (optionName )) {
149
195
return value ;
150
196
}
151
197
}
198
+
152
199
return null ;
153
200
}
154
201
@@ -212,7 +259,7 @@ public enum KeyCachingOption {
212
259
213
260
ALL ("all" ), NONE ("none" );
214
261
215
- private String value ;
262
+ private final String value ;
216
263
217
264
KeyCachingOption (String value ) {
218
265
this .value = value ;
@@ -241,7 +288,7 @@ public enum CachingOption implements Option {
241
288
242
289
ROWS_PER_PARTITION ("rows_per_partition" , String .class , true , false , true );
243
290
244
- private Option delegate ;
291
+ private final Option delegate ;
245
292
246
293
CachingOption (String name , Class <?> type , boolean requiresValue , boolean escapesValue , boolean quotesValue ) {
247
294
this .delegate = new DefaultOption (name , type , requiresValue , escapesValue , quotesValue );
@@ -310,40 +357,52 @@ public enum CompactionOption implements Option {
310
357
* {@code class}
311
358
*/
312
359
CLASS ("class" , String .class , true , false , true ),
360
+
313
361
/**
314
362
* {@code tombstone_threshold}
315
363
*/
316
- TOMBSTONE_THRESHOLD ("tombstone_threshold" , Double .class , true , false , false ),
364
+ TOMBSTONE_THRESHOLD ("tombstone_threshold" , Double .class ),
365
+
317
366
/**
318
367
* {@code tombstone_compaction_interval}
319
368
*/
320
- TOMBSTONE_COMPACTION_INTERVAL ("tombstone_compaction_interval" , Double .class , true , false , false ),
369
+ TOMBSTONE_COMPACTION_INTERVAL ("tombstone_compaction_interval" , Double .class ),
370
+
321
371
/**
322
372
* {@code min_sstable_size}
323
373
*/
324
- MIN_SSTABLE_SIZE ("min_sstable_size" , Long .class , true , false , false ),
374
+ MIN_SSTABLE_SIZE ("min_sstable_size" , Long .class ),
375
+
325
376
/**
326
377
* {@code min_threshold}
327
378
*/
328
- MIN_THRESHOLD ("min_threshold" , Long .class , true , false , false ),
379
+ MIN_THRESHOLD ("min_threshold" , Long .class ),
380
+
329
381
/**
330
382
* {@code max_threshold}
331
383
*/
332
- MAX_THRESHOLD ("max_threshold" , Long .class , true , false , false ),
384
+ MAX_THRESHOLD ("max_threshold" , Long .class ),
385
+
333
386
/**
334
387
* {@code bucket_low}
335
388
*/
336
- BUCKET_LOW ("bucket_low" , Double .class , true , false , false ),
389
+ BUCKET_LOW ("bucket_low" , Double .class ),
390
+
337
391
/**
338
392
* {@code bucket_high}
339
393
*/
340
- BUCKET_HIGH ("bucket_high" , Double .class , true , false , false ),
394
+ BUCKET_HIGH ("bucket_high" , Double .class ),
395
+
341
396
/**
342
397
* {@code sstable_size_in_mb}
343
398
*/
344
- SSTABLE_SIZE_IN_MB ("sstable_size_in_mb" , Long .class , true , false , false );
399
+ SSTABLE_SIZE_IN_MB ("sstable_size_in_mb" , Long .class );
400
+
401
+ private final Option delegate ;
345
402
346
- private Option delegate ;
403
+ CompactionOption (String name , Class <?> type ) {
404
+ this (name , type , true , false , false );
405
+ }
347
406
348
407
CompactionOption (String name , Class <?> type , boolean requiresValue , boolean escapesValue , boolean quotesValue ) {
349
408
this .delegate = new DefaultOption (name , type , requiresValue , escapesValue , quotesValue );
@@ -411,16 +470,18 @@ public enum CompressionOption implements Option {
411
470
* {@code sstable_compression}
412
471
*/
413
472
SSTABLE_COMPRESSION ("sstable_compression" , String .class , true , false , true ),
473
+
414
474
/**
415
475
* {@code chunk_length_kb}
416
476
*/
417
477
CHUNK_LENGTH_KB ("chunk_length_kb" , Long .class , true , false , false ),
478
+
418
479
/**
419
480
* {@code crc_check_chance}
420
481
*/
421
482
CRC_CHECK_CHANCE ("crc_check_chance" , Double .class , true , false , false );
422
483
423
- private Option delegate ;
484
+ private final Option delegate ;
424
485
425
486
CompressionOption (String name , Class <?> type , boolean requiresValue , boolean escapesValue , boolean quotesValue ) {
426
487
this .delegate = new DefaultOption (name , type , requiresValue , escapesValue , quotesValue );
0 commit comments