Skip to content

Commit b016d82

Browse files
committed
Update JavaDocs
1 parent 5c2ab59 commit b016d82

20 files changed

+153
-28
lines changed

src/main/java/com/datastax/astra/client/Collection.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ public CollectionDefinition getDefinition() {
188188
* Retrieves the configuration options for the collection, including vector and indexing settings.
189189
* These options specify how the collection should be created and managed, potentially affecting
190190
* performance, search capabilities, and data organization.
191-
* <p></p>
192191
* <p>Example usage:</p>
193192
* <pre>
194193
* {@code
@@ -268,12 +267,10 @@ public final InsertOneResult insertOne(DOC document) {
268267
/**
269268
* Insert a single document in the collection in an atomic operation.
270269
*
271-
* <p>
272270
* <blockquote><b>Note:</b>If an `_id` is explicitly provided, which corresponds to a document
273271
* that exists already in the collection, an error is raised and the insertion fails.
274272
* Inserts the provided document. If the document is missing an identifier, the server will generate one.
275273
* </blockquote>
276-
* </p>
277274
*
278275
* @param document
279276
* the document expressing the document to insert. The `_id` field of the document can be left out, in which case it will be created automatically.
@@ -291,12 +288,10 @@ public final InsertOneResult insertOne(DOC document, float[] embeddings) {
291288
/**
292289
* Insert a single document in the collection in an atomic operation.
293290
*
294-
* <p>
295291
* <blockquote><b>Note:</b>If an `_id` is explicitly provided, which corresponds to a document
296292
* that exists already in the collection, an error is raised and the insertion fails.
297293
* Inserts the provided document. If the document is missing an identifier, the server will generate one.
298294
* </blockquote>
299-
* </p>
300295
*
301296
* @param document
302297
* the document expressing the document to insert. The `_id` field of the document can be left out, in which case it will be created automatically.
@@ -341,7 +336,7 @@ private InsertOneResult _insertOne(Document document) {
341336
* if the documents list is null or empty, or any of the documents in the list are null
342337
*/
343338
public InsertManyResult insertMany(List<? extends DOC> documents) {
344-
return insertMany(documents, InsertManyOptions.builder().build());
339+
return insertMany(documents, new InsertManyOptions());
345340
}
346341

347342
/**
@@ -447,6 +442,7 @@ public Optional<DOC> findOne(Filter filter) {
447442
*
448443
* @param filter The {@link Filter} instance containing the criteria used to identify the desired document.
449444
* It specifies the conditions that a document must meet to be considered a match.
445+
* @param options The {@link FindOneOptions} instance containing additional options for the find operation,
450446
* @return An {@link Optional<DOC>} that contains the found document if one exists that matches
451447
* the filter criteria. Returns an empty {@link Optional} if no matching document is found,
452448
* enabling safe retrieval operations without the risk of {@link java.util.NoSuchElementException}.
@@ -739,10 +735,29 @@ public int countDocuments(Filter filter, int upperBound) throws TooManyDocuments
739735
// --- Delete ----
740736
// ----------------------------
741737

738+
/**
739+
* attribute for the delete count
740+
*/
742741
public static final String DELETED_COUNT = "deletedCount";
742+
743+
/**
744+
* attribute for the matched count
745+
*/
743746
public static final String MATCHED_COUNT = "matchedCount";
747+
748+
/**
749+
* attribute for the modified count
750+
*/
744751
public static final String MODIFIED_COUNT = "modifiedCount";
752+
753+
/**
754+
* attribute for upserted Id
755+
*/
745756
public static final String UPSERTED_ID = "upsertedId";
757+
758+
/**
759+
* attribute for the moreData
760+
*/
746761
public static final String MORE_DATA = "moreData";
747762

748763
/**

src/main/java/com/datastax/astra/client/DataAPIOptions.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ public static class DataAPIClientOptionsBuilder {
144144
/** Default is to use Astra in Production. */
145145
private DataAPIDestination destination = DataAPIDestination.ASTRA;
146146

147+
/**
148+
* Default constructor.
149+
*/
150+
public DataAPIClientOptionsBuilder() {}
151+
147152
/**
148153
* Builder pattern, update caller information.
149154
*
@@ -282,7 +287,7 @@ public DataAPIClientOptionsBuilder withDestination(DataAPIDestination destinatio
282287
* @param retryDelay the delay between two retry attempts, expressed in milliseconds.
283288
* Must be a non-negative number.
284289
* @return a reference to this builder, allowing for method chaining.
285-
* <p></p>
290+
*
286291
* Example usage:
287292
* <pre>
288293
* {@code

src/main/java/com/datastax/astra/client/Database.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@
4848
@Slf4j
4949
public class Database extends AbstractCommandRunner {
5050

51-
/** Current Namespace information.
52-
* -- GETTER --
53-
* Gets the name of the database.
54-
*
55-
* @return the database name
56-
*/
51+
/** Current Namespace information.*/
5752
@Getter
5853
private final String namespaceName;
5954

@@ -136,13 +131,20 @@ public Database(String apiEndpoint, String token, String namespace, DataAPIOptio
136131
// ---- Access Database Admin ----
137132
// ------------------------------------------
138133

134+
/**
135+
* Access a database Admin client from the database
136+
* @return
137+
* database admin
138+
*/
139139
public DatabaseAdmin getDatabaseAdmin() {
140140
return getDatabaseAdmin(this.token);
141141
}
142142

143143
/**
144144
* Gets the name of the database.
145145
*
146+
* @param superUserToken
147+
* provide a token with super user role
146148
* @return the database name
147149
*/
148150
public DatabaseAdmin getDatabaseAdmin(String superUserToken) {
@@ -245,6 +247,8 @@ public void drop() {
245247
*
246248
* @param collectionName
247249
* the name for the new collection to create
250+
* @return
251+
* the instance of collection
248252
*/
249253
public Collection<Document> createCollection(String collectionName) {
250254
return createCollection(collectionName, null, Document.class);
@@ -275,6 +279,8 @@ public Collection<Document> createCollection(String collectionName, int dimensio
275279
* vector metric
276280
* @param documentClass
277281
* class of document to return
282+
* @param <DOC>
283+
* working class for the document
278284
* @return
279285
* the instance of collection
280286
*/
@@ -290,6 +296,11 @@ public <DOC> Collection<DOC> createCollection(String collectionName, int dimensi
290296
*
291297
* @param collectionName
292298
* the name for the new collection to create
299+
* @param documentClass
300+
* class of document to return
301+
* @param <DOC>
302+
* working class for the document
303+
* @return the collection
293304
*/
294305
public <DOC> Collection<DOC> createCollection(String collectionName, Class<DOC> documentClass) {
295306
return createCollection(collectionName, null, documentClass);
@@ -302,6 +313,7 @@ public <DOC> Collection<DOC> createCollection(String collectionName, Class<DOC>
302313
* the name for the new collection to create
303314
* @param collectionOptions
304315
* various options for creating the collection
316+
* @return the collection
305317
*/
306318
public Collection<Document> createCollection(String collectionName, CollectionOptions collectionOptions) {
307319
return createCollection(collectionName, collectionOptions, Document.class);
@@ -314,6 +326,11 @@ public Collection<Document> createCollection(String collectionName, CollectionOp
314326
* the name for the new collection to create
315327
* @param collectionOptions
316328
* various options for creating the collection
329+
* @param documentClass
330+
* the default class to cast any documents returned from the database into.
331+
* @param <DOC>
332+
* working class for the document
333+
* @return the collection
317334
*/
318335
public <DOC> Collection<DOC> createCollection(String collectionName, CollectionOptions collectionOptions, Class<DOC> documentClass) {
319336
hasLength(collectionName, "collectionName");

src/main/java/com/datastax/astra/client/exception/TooManyDocumentsToCountException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public TooManyDocumentsToCountException() {
3636

3737
/**
3838
* Default constructor.
39+
*
40+
* @param upperLimit
41+
* what it the most the count can return
3942
*/
4043
public TooManyDocumentsToCountException(int upperLimit) {
4144
super("Document count exceeds upper bound set in method call " + upperLimit);

src/main/java/com/datastax/astra/client/model/Command.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public class Command implements Serializable {
5353
*
5454
* @param name
5555
* unique command name
56-
*
56+
* @return
57+
* instance of the command
5758
*/
5859
public static Command create(String name) {
5960
return new Command(name);
@@ -158,6 +159,8 @@ public Command withDocument(Object document) {
158159
*
159160
* @param documents
160161
* documents for the command
162+
* @param <DOC>
163+
* working clas for documents
161164
* @return
162165
* self-reference
163166
*/

src/main/java/com/datastax/astra/client/model/Document.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ public <T> T getId(@NonNull final Class<T> clazz) {
243243
* id value
244244
* @param <T>
245245
* type of id
246+
* @return
247+
* self reference
246248
*/
247249
public <T> Document id(T id) {
248250
return appendIfNotNull(ID, id);
@@ -285,6 +287,8 @@ public Optional<float[]> getVector() {
285287
*
286288
* @param vector
287289
* vector value
290+
* @return
291+
* self reference
288292
*/
289293
public Document vector(float[] vector) {
290294
return append(VECTOR, vector);
@@ -567,66 +571,79 @@ public String toJson() {
567571

568572
// Vanilla Map methods delegate to map field
569573

574+
/** {@inheritDoc} */
570575
@Override
571576
public int size() {
572577
return documentMap.size();
573578
}
574579

580+
/** {@inheritDoc} */
575581
@Override
576582
public boolean isEmpty() {
577583
return documentMap.isEmpty();
578584
}
579585

586+
/** {@inheritDoc} */
580587
@Override
581588
public boolean containsValue(final Object value) {
582589
return documentMap.containsValue(value);
583590
}
584591

592+
/** {@inheritDoc} */
585593
@Override
586594
public boolean containsKey(final Object key) {
587595
return documentMap.containsKey(key);
588596
}
589597

598+
/** {@inheritDoc} */
590599
@Override
591600
public Object get(final Object key) {
592601
return documentMap.get(key);
593602
}
594603

604+
/** {@inheritDoc} */
595605
@Override
596606
public Object put(final String key, final Object value) {
597607
return documentMap.put(key, value);
598608
}
599609

610+
/** {@inheritDoc} */
600611
@Override
601612
public Object remove(final Object key) {
602613
return documentMap.remove(key);
603614
}
604615

616+
/** {@inheritDoc} */
605617
@Override
606618
public void putAll(final Map<? extends String, ?> map) {
607619
documentMap.putAll(map);
608620
}
609621

622+
/** {@inheritDoc} */
610623
@Override
611624
public void clear() {
612625
documentMap.clear();
613626
}
614627

628+
/** {@inheritDoc} */
615629
@Override
616630
public Set<String> keySet() {
617631
return documentMap.keySet();
618632
}
619633

634+
/** {@inheritDoc} */
620635
@Override
621636
public Collection<Object> values() {
622637
return documentMap.values();
623638
}
624639

640+
/** {@inheritDoc} */
625641
@Override
626642
public Set<Entry<String, Object>> entrySet() {
627643
return documentMap.entrySet();
628644
}
629645

646+
/** {@inheritDoc} */
630647
@Override
631648
public boolean equals(final Object o) {
632649
if (this == o) {
@@ -641,10 +658,10 @@ public boolean equals(final Object o) {
641658
if (!documentMap.equals(document.documentMap)) {
642659
return false;
643660
}
644-
645661
return true;
646662
}
647663

664+
/** {@inheritDoc} */
648665
@Override
649666
public int hashCode() {
650667
return documentMap.hashCode();

src/main/java/com/datastax/astra/client/model/collections/CollectionDefinition.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public class CollectionDefinition {
3939
*/
4040
private CollectionOptions options;
4141

42+
/**
43+
* Default constructor.
44+
*/
45+
public CollectionDefinition() {}
46+
4247
/** {@inheritDoc} */
4348
@Override
4449
public String toString() {

src/main/java/com/datastax/astra/client/model/collections/CollectionOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public class CollectionOptions {
5050
*/
5151
private IndexingOptions indexing;
5252

53+
/**
54+
* Default constructor.
55+
*/
56+
public CollectionOptions() {}
57+
5358
/**
5459
* Subclass representing the indexing options.
5560
*/

src/main/java/com/datastax/astra/client/model/find/FindOneAndReplaceOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public class FindOneAndReplaceOptions {
5353
*/
5454
ReturnDocument returnDocument = ReturnDocument.after;
5555

56+
/**
57+
* Default constructor.
58+
*/
59+
public FindOneAndReplaceOptions() {}
60+
5661
/**
5762
* Options of the Return Document flag
5863
*/

src/main/java/com/datastax/astra/client/model/find/FindOneAndReplaceResult.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* working class document
3131
*/
3232
@Data
33-
@NoArgsConstructor
3433
public class FindOneAndReplaceResult<DOC> {
3534

3635
/**

0 commit comments

Comments
 (0)