Skip to content

Commit 3e2fe87

Browse files
committed
docs: add comprehensive Javadoc for dynamic indexing classes
Add missing Javadoc comments to fix build warnings in the indexing module. This includes documentation for constructors, builder classes, and all public methods in ConfigurableIndexDefinitionProvider, EphemeralIndexService, IndexMigrationService, MigrationResult, ReindexResult, and RediSearchIndexer. Also wrap SpEL expressions in {@code} blocks in RediSearchIndexer to prevent them from being parsed as Javadoc tags.
1 parent 91befbd commit 3e2fe87

File tree

6 files changed

+415
-16
lines changed

6 files changed

+415
-16
lines changed

redis-om-spring/src/main/java/com/redis/om/spring/indexing/ConfigurableIndexDefinitionProvider.java

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public class ConfigurableIndexDefinitionProvider {
3434
private final Map<Class<?>, IndexResolver> customResolvers = new ConcurrentHashMap<>();
3535
private final ObjectMapper objectMapper = new ObjectMapper();
3636

37+
/**
38+
* Constructs a new ConfigurableIndexDefinitionProvider.
39+
*
40+
* @param indexer the RediSearchIndexer to use for index operations
41+
* @param applicationContext the Spring application context
42+
*/
3743
public ConfigurableIndexDefinitionProvider(RediSearchIndexer indexer, ApplicationContext applicationContext) {
3844
this.indexer = indexer;
3945
this.applicationContext = applicationContext;
@@ -276,15 +282,31 @@ public static class IndexDefinitionConfig {
276282
private final String indexName;
277283
private final String keyPrefix;
278284

285+
/**
286+
* Constructs a new IndexDefinitionConfig.
287+
*
288+
* @param indexName the name of the index
289+
* @param keyPrefix the key prefix for the index
290+
*/
279291
public IndexDefinitionConfig(String indexName, String keyPrefix) {
280292
this.indexName = indexName;
281293
this.keyPrefix = keyPrefix;
282294
}
283295

296+
/**
297+
* Returns the index name.
298+
*
299+
* @return the index name
300+
*/
284301
public String getIndexName() {
285302
return indexName;
286303
}
287304

305+
/**
306+
* Returns the key prefix.
307+
*
308+
* @return the key prefix
309+
*/
288310
public String getKeyPrefix() {
289311
return keyPrefix;
290312
}
@@ -298,20 +320,42 @@ public static class IndexDefinition {
298320
private final String keyPrefix;
299321
private final Class<?> entityClass;
300322

323+
/**
324+
* Constructs a new IndexDefinition.
325+
*
326+
* @param indexName the name of the index
327+
* @param keyPrefix the key prefix for the index
328+
* @param entityClass the entity class for the index
329+
*/
301330
public IndexDefinition(String indexName, String keyPrefix, Class<?> entityClass) {
302331
this.indexName = indexName;
303332
this.keyPrefix = keyPrefix;
304333
this.entityClass = entityClass;
305334
}
306335

336+
/**
337+
* Returns the index name.
338+
*
339+
* @return the index name
340+
*/
307341
public String getIndexName() {
308342
return indexName;
309343
}
310344

345+
/**
346+
* Returns the key prefix.
347+
*
348+
* @return the key prefix
349+
*/
311350
public String getKeyPrefix() {
312351
return keyPrefix;
313352
}
314353

354+
/**
355+
* Returns the entity class.
356+
*
357+
* @return the entity class
358+
*/
315359
public Class<?> getEntityClass() {
316360
return entityClass;
317361
}
@@ -325,39 +369,83 @@ public static class IndexStatistics {
325369
private final long documentCount;
326370
private final long indexSize;
327371

372+
/**
373+
* Constructs a new IndexStatistics instance.
374+
*
375+
* @param indexName the name of the index
376+
* @param documentCount the number of documents in the index
377+
* @param indexSize the size of the index in bytes
378+
*/
328379
public IndexStatistics(String indexName, long documentCount, long indexSize) {
329380
this.indexName = indexName;
330381
this.documentCount = documentCount;
331382
this.indexSize = indexSize;
332383
}
333384

385+
/**
386+
* Returns the name of the index.
387+
*
388+
* @return the index name
389+
*/
334390
public String getIndexName() {
335391
return indexName;
336392
}
337393

394+
/**
395+
* Returns the number of documents in the index.
396+
*
397+
* @return the document count
398+
*/
338399
public long getDocumentCount() {
339400
return documentCount;
340401
}
341402

403+
/**
404+
* Returns the size of the index in bytes.
405+
*
406+
* @return the index size
407+
*/
342408
public long getIndexSize() {
343409
return indexSize;
344410
}
345411
}
346412

347413
/**
348-
* Inner class representing validation results.
414+
* Inner class representing validation results for index configurations.
349415
*/
350416
public static class ValidationResult {
351417
private final List<String> errors = new ArrayList<>();
352418

419+
/**
420+
* Creates a new empty ValidationResult.
421+
*/
422+
public ValidationResult() {
423+
// Default constructor
424+
}
425+
426+
/**
427+
* Adds an error message to this validation result.
428+
*
429+
* @param error the error message to add
430+
*/
353431
public void addError(String error) {
354432
errors.add(error);
355433
}
356434

435+
/**
436+
* Checks if this validation result is valid (has no errors).
437+
*
438+
* @return true if there are no errors, false otherwise
439+
*/
357440
public boolean isValid() {
358441
return errors.isEmpty();
359442
}
360443

444+
/**
445+
* Returns the list of error messages.
446+
*
447+
* @return the list of errors
448+
*/
361449
public List<String> getErrors() {
362450
return errors;
363451
}

redis-om-spring/src/main/java/com/redis/om/spring/indexing/EphemeralIndexService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public class EphemeralIndexService implements DisposableBean {
2626
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
2727
private final ConcurrentHashMap<String, EphemeralIndexInfo> ephemeralIndexes = new ConcurrentHashMap<>();
2828

29+
/**
30+
* Constructs a new EphemeralIndexService.
31+
*
32+
* @param indexer the RediSearchIndexer to use for index operations
33+
*/
2934
@Autowired
3035
public EphemeralIndexService(RediSearchIndexer indexer) {
3136
this.indexer = indexer;

redis-om-spring/src/main/java/com/redis/om/spring/indexing/IndexMigrationService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ private enum MigrationStatus {
3636
FAILED
3737
}
3838

39+
/**
40+
* Constructs a new IndexMigrationService.
41+
*
42+
* @param indexer the RediSearchIndexer to use for index operations
43+
* @param applicationContext the Spring application context
44+
*/
3945
public IndexMigrationService(RediSearchIndexer indexer, ApplicationContext applicationContext) {
4046
this.indexer = indexer;
4147
this.applicationContext = applicationContext;

redis-om-spring/src/main/java/com/redis/om/spring/indexing/MigrationResult.java

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,90 @@ private MigrationResult(Builder builder) {
2828
this.documentsProcessed = builder.documentsProcessed;
2929
}
3030

31+
/**
32+
* Returns whether the migration was successful.
33+
*
34+
* @return true if the migration succeeded, false otherwise
35+
*/
3136
public boolean isSuccessful() {
3237
return successful;
3338
}
3439

40+
/**
41+
* Returns the name of the old index before migration.
42+
*
43+
* @return the old index name
44+
*/
3545
public String getOldIndexName() {
3646
return oldIndexName;
3747
}
3848

49+
/**
50+
* Returns the name of the new index after migration.
51+
*
52+
* @return the new index name
53+
*/
3954
public String getNewIndexName() {
4055
return newIndexName;
4156
}
4257

58+
/**
59+
* Returns the migration strategy used.
60+
*
61+
* @return the migration strategy
62+
*/
4363
public MigrationStrategy getStrategy() {
4464
return strategy;
4565
}
4666

67+
/**
68+
* Returns the start time of the migration.
69+
*
70+
* @return the start time
71+
*/
4772
public Instant getStartTime() {
4873
return startTime;
4974
}
5075

76+
/**
77+
* Returns the end time of the migration.
78+
*
79+
* @return the end time
80+
*/
5181
public Instant getEndTime() {
5282
return endTime;
5383
}
5484

85+
/**
86+
* Returns the error message if the migration failed.
87+
*
88+
* @return the error message, or null if successful
89+
*/
5590
public String getErrorMessage() {
5691
return errorMessage;
5792
}
5893

94+
/**
95+
* Returns the number of documents processed during migration.
96+
*
97+
* @return the number of documents processed
98+
*/
5999
public long getDocumentsProcessed() {
60100
return documentsProcessed;
61101
}
62102

103+
/**
104+
* Creates a new Builder for constructing MigrationResult instances.
105+
*
106+
* @return a new Builder instance
107+
*/
63108
public static Builder builder() {
64109
return new Builder();
65110
}
66111

112+
/**
113+
* Builder class for constructing MigrationResult instances.
114+
*/
67115
public static class Builder {
68116
private boolean successful;
69117
private String oldIndexName;
@@ -74,48 +122,108 @@ public static class Builder {
74122
private String errorMessage;
75123
private long documentsProcessed;
76124

125+
/**
126+
* Creates a new Builder instance.
127+
*/
128+
public Builder() {
129+
// Default constructor
130+
}
131+
132+
/**
133+
* Sets whether the migration was successful.
134+
*
135+
* @param successful true if successful, false otherwise
136+
* @return this builder for chaining
137+
*/
77138
public Builder successful(boolean successful) {
78139
this.successful = successful;
79140
return this;
80141
}
81142

143+
/**
144+
* Sets the old index name.
145+
*
146+
* @param oldIndexName the name of the old index
147+
* @return this builder for chaining
148+
*/
82149
public Builder oldIndexName(String oldIndexName) {
83150
this.oldIndexName = oldIndexName;
84151
return this;
85152
}
86153

154+
/**
155+
* Sets the new index name.
156+
*
157+
* @param newIndexName the name of the new index
158+
* @return this builder for chaining
159+
*/
87160
public Builder newIndexName(String newIndexName) {
88161
this.newIndexName = newIndexName;
89162
return this;
90163
}
91164

165+
/**
166+
* Sets the migration strategy used.
167+
*
168+
* @param strategy the migration strategy
169+
* @return this builder for chaining
170+
*/
92171
public Builder strategy(MigrationStrategy strategy) {
93172
this.strategy = strategy;
94173
return this;
95174
}
96175

176+
/**
177+
* Sets the start time of the migration.
178+
*
179+
* @param startTime the start time
180+
* @return this builder for chaining
181+
*/
97182
public Builder startTime(Instant startTime) {
98183
this.startTime = startTime;
99184
return this;
100185
}
101186

187+
/**
188+
* Sets the end time of the migration.
189+
*
190+
* @param endTime the end time
191+
* @return this builder for chaining
192+
*/
102193
public Builder endTime(Instant endTime) {
103194
this.endTime = endTime;
104195
return this;
105196
}
106197

198+
/**
199+
* Sets the error message for failed migrations.
200+
*
201+
* @param errorMessage the error message
202+
* @return this builder for chaining
203+
*/
107204
public Builder errorMessage(String errorMessage) {
108205
this.errorMessage = errorMessage;
109206
return this;
110207
}
111208

209+
/**
210+
* Sets the number of documents processed.
211+
*
212+
* @param documentsProcessed the number of documents
213+
* @return this builder for chaining
214+
*/
112215
public Builder documentsProcessed(long documentsProcessed) {
113216
this.documentsProcessed = documentsProcessed;
114217
return this;
115218
}
116219

220+
/**
221+
* Builds the MigrationResult instance.
222+
*
223+
* @return a new MigrationResult with the configured values
224+
*/
117225
public MigrationResult build() {
118226
return new MigrationResult(this);
119227
}
120228
}
121-
}
229+
}

0 commit comments

Comments
 (0)