type) throws ArangoDBException;
+
/**
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
@@ -89,14 +100,11 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
* @see API
* Documentation
*/
- MultiDocumentEntity> insertDocuments(Collection values) throws ArangoDBException;
+ MultiDocumentEntity> insertDocuments(Collection> values) throws ArangoDBException;
/**
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
@@ -108,11 +116,23 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
MultiDocumentEntity> insertDocuments(
Collection values, DocumentCreateOptions options) throws ArangoDBException;
+ /**
+ * Creates new documents from the given documents, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the documents
+ * @throws ArangoDBException
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> insertDocuments(
+ Collection values, DocumentCreateOptions options, Class type) throws ArangoDBException;
+
/**
* Bulk imports the given values into the collection.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values a list of Objects that will be stored as documents
* @return information about the import
@@ -122,9 +142,6 @@ MultiDocumentEntity> insertDocuments(
/**
* Bulk imports the given values into the collection.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values a list of Objects that will be stored as documents
* @param options Additional options, can be null
@@ -135,9 +152,6 @@ MultiDocumentEntity> insertDocuments(
/**
* Bulk imports the given values into the collection.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values JSON-encoded array of objects that will be stored as documents
* @return information about the import
@@ -147,9 +161,6 @@ MultiDocumentEntity> insertDocuments(
/**
* Bulk imports the given values into the collection.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values JSON-encoded array of objects that will be stored as documents
* @param options Additional options, can be null
@@ -216,7 +227,7 @@ MultiDocumentEntity getDocuments(Collection keys, Class type,
* @see API
* Documentation
*/
- DocumentUpdateEntity replaceDocument(String key, T value) throws ArangoDBException;
+ DocumentUpdateEntity replaceDocument(String key, Object value) throws ArangoDBException;
/**
* Replaces the document with {@code key} with the one in the body, provided there is such a document and no
@@ -233,12 +244,25 @@ MultiDocumentEntity getDocuments(Collection keys, Class type,
DocumentUpdateEntity replaceDocument(String key, T value, DocumentReplaceOptions options)
throws ArangoDBException;
+ /**
+ * Replaces the document with {@code key} with the one in the body, provided there is such a document and no
+ * precondition is violated
+ *
+ * @param key The key of the document
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the document
+ * @throws ArangoDBException
+ * @see API
+ * Documentation
+ */
+ DocumentUpdateEntity replaceDocument(String key, T value, DocumentReplaceOptions options, Class type)
+ throws ArangoDBException;
+
/**
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
@@ -246,14 +270,11 @@ DocumentUpdateEntity replaceDocument(String key, T value, DocumentReplace
* @see API
* Documentation
*/
- MultiDocumentEntity> replaceDocuments(Collection values) throws ArangoDBException;
+ MultiDocumentEntity> replaceDocuments(Collection> values) throws ArangoDBException;
/**
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
- *
- * Limitations:
- * - the fields having {@code null} value are always removed during serialization
*
* @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
@@ -265,6 +286,21 @@ DocumentUpdateEntity replaceDocument(String key, T value, DocumentReplace
MultiDocumentEntity> replaceDocuments(
Collection values, DocumentReplaceOptions options) throws ArangoDBException;
+ /**
+ * Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
+ * specified by the _key attributes in the documents in values.
+ *
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the documents
+ * @throws ArangoDBException
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> replaceDocuments(
+ Collection values, DocumentReplaceOptions options, Class type) throws ArangoDBException;
+
/**
* Partially updates the document identified by document-key. The value must contain a document with the attributes
* to patch (the patch document). All attributes from the patch document will be added to the existing document if
@@ -277,7 +313,7 @@ MultiDocumentEntity> replaceDocuments(
* @see API
* Documentation
*/
- DocumentUpdateEntity updateDocument(String key, T value) throws ArangoDBException;
+ DocumentUpdateEntity updateDocument(String key, Object value) throws ArangoDBException;
/**
* Partially updates the document identified by document-key. The value must contain a document with the attributes
@@ -324,7 +360,7 @@ DocumentUpdateEntity updateDocument(String key, T value, DocumentUpdat
* @see API
* Documentation
*/
- MultiDocumentEntity> updateDocuments(Collection values) throws ArangoDBException;
+ MultiDocumentEntity> updateDocuments(Collection> values) throws ArangoDBException;
/**
* Partially updates documents, the documents to update are specified by the _key attributes in the objects on
@@ -370,6 +406,19 @@ MultiDocumentEntity> updateDocuments(
*/
DocumentDeleteEntity deleteDocument(String key) throws ArangoDBException;
+ /**
+ * Deletes the document with the given {@code key} from the collection.
+ *
+ * @param key The key of the document
+ * @param options Additional options, can be null
+ * @return information about the document
+ * @throws ArangoDBException
+ * @see API
+ * Documentation
+ */
+ DocumentDeleteEntity deleteDocument(String key, DocumentDeleteOptions options)
+ throws ArangoDBException;
+
/**
* Deletes the document with the given {@code key} from the collection.
*
@@ -382,7 +431,7 @@ MultiDocumentEntity> updateDocuments(
* @see API
* Documentation
*/
- DocumentDeleteEntity deleteDocument(String key, Class type, DocumentDeleteOptions options)
+ DocumentDeleteEntity deleteDocument(String key, DocumentDeleteOptions options, Class type)
throws ArangoDBException;
/**
@@ -397,6 +446,20 @@ DocumentDeleteEntity deleteDocument(String key, Class type, DocumentDe
*/
MultiDocumentEntity> deleteDocuments(Collection> values) throws ArangoDBException;
+ /**
+ * Deletes multiple documents from the collection.
+ *
+ * @param values The keys of the documents or the documents themselves
+ * @param options Additional options, can be null
+ * @return information about the documents
+ * @throws ArangoDBException
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> deleteDocuments(
+ Collection> values, DocumentDeleteOptions options) throws ArangoDBException;
+
/**
* Deletes multiple documents from the collection.
*
@@ -411,7 +474,7 @@ DocumentDeleteEntity deleteDocument(String key, Class type, DocumentDe
* Documentation
*/
MultiDocumentEntity> deleteDocuments(
- Collection> values, Class type, DocumentDeleteOptions options) throws ArangoDBException;
+ Collection> values, DocumentDeleteOptions options, Class type) throws ArangoDBException;
/**
* Checks if the document exists by reading a single document head
diff --git a/src/main/java/com/arangodb/async/ArangoCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
index 1df9efcd3..2869b5f82 100644
--- a/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
@@ -61,7 +61,7 @@ public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
* @see API
* Documentation
*/
- CompletableFuture> insertDocument(final T value);
+ CompletableFuture> insertDocument(final Object value);
/**
* Creates a new document from the given document, unless there is already a document with the _key given. If no
@@ -75,6 +75,19 @@ public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
*/
CompletableFuture> insertDocument(final T value, final DocumentCreateOptions options);
+ /**
+ * Creates a new document from the given document, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the document
+ * @see API
+ * Documentation
+ */
+ CompletableFuture> insertDocument(final T value, final DocumentCreateOptions options, Class type);
+
/**
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
@@ -84,7 +97,7 @@ public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
* @see API
* Documentation
*/
- CompletableFuture>> insertDocuments(final Collection values);
+ CompletableFuture>> insertDocuments(final Collection> values);
/**
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
@@ -100,6 +113,22 @@ CompletableFuture>> insertDocume
final Collection values,
final DocumentCreateOptions options);
+ /**
+ * Creates new documents from the given documents, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> insertDocuments(
+ final Collection values,
+ final DocumentCreateOptions options,
+ final Class type);
+
/**
* Imports documents
*
@@ -192,7 +221,7 @@ CompletableFuture> getDocuments(
* @see API
* Documentation
*/
- CompletableFuture> replaceDocument(final String key, final T value);
+ CompletableFuture> replaceDocument(final String key, final Object value);
/**
* Replaces the document with key with the one in the body, provided there is such a document and no precondition is
@@ -210,6 +239,24 @@ CompletableFuture> replaceDocument(
final T value,
final DocumentReplaceOptions options);
+ /**
+ * Replaces the document with key with the one in the body, provided there is such a document and no precondition is
+ * violated
+ *
+ * @param key The key of the document
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the document
+ * @see API
+ * Documentation
+ */
+ CompletableFuture> replaceDocument(
+ final String key,
+ final T value,
+ final DocumentReplaceOptions options,
+ final Class type);
+
/**
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
@@ -219,7 +266,7 @@ CompletableFuture> replaceDocument(
* @see API
* Documentation
*/
- CompletableFuture>> replaceDocuments(final Collection values);
+ CompletableFuture>> replaceDocuments(final Collection> values);
/**
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
@@ -235,6 +282,22 @@ CompletableFuture>> replaceDocum
final Collection values,
final DocumentReplaceOptions options);
+ /**
+ * Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
+ * specified by the _key attributes in the documents in values.
+ *
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param options Additional options, can be null
+ * @param type Deserialization target type for the returned documents.
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> replaceDocuments(
+ final Collection values,
+ final DocumentReplaceOptions options,
+ final Class type);
+
/**
* Partially updates the document identified by document-key. The value must contain a document with the attributes
* to patch (the patch document). All attributes from the patch document will be added to the existing document if
@@ -246,7 +309,7 @@ CompletableFuture>> replaceDocum
* @see API
* Documentation
*/
- CompletableFuture> updateDocument(final String key, final T value);
+ CompletableFuture> updateDocument(final String key, final Object value);
/**
* Partially updates the document identified by document-key. The value must contain a document with the attributes
@@ -295,7 +358,7 @@ CompletableFuture> updateDocument(
* @see API
* Documentation
*/
- CompletableFuture>> updateDocuments(final Collection values);
+ CompletableFuture>> updateDocuments(final Collection> values);
/**
* Partially updates documents, the documents to update are specified by the _key attributes in the objects on
@@ -341,6 +404,19 @@ CompletableFuture>> updateDoc
*/
CompletableFuture> deleteDocument(final String key);
+ /**
+ * Removes a document
+ *
+ * @param key The key of the document
+ * @param options Additional options, can be null
+ * @return information about the document
+ * @see API
+ * Documentation
+ */
+ CompletableFuture> deleteDocument(
+ final String key,
+ final DocumentDeleteOptions options);
+
/**
* Removes a document
*
@@ -354,8 +430,8 @@ CompletableFuture>> updateDoc
*/
CompletableFuture> deleteDocument(
final String key,
- final Class type,
- final DocumentDeleteOptions options);
+ final DocumentDeleteOptions options,
+ final Class type);
/**
* Removes multiple document
@@ -368,6 +444,20 @@ CompletableFuture> deleteDocument(
*/
CompletableFuture>> deleteDocuments(final Collection> values);
+ /**
+ * Removes multiple document
+ *
+ * @param values The keys of the documents or the documents themselves
+ * @param options Additional options, can be null
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> deleteDocuments(
+ final Collection> values,
+ final DocumentDeleteOptions options);
+
/**
* Removes multiple document
*
@@ -382,8 +472,8 @@ CompletableFuture> deleteDocument(
*/
CompletableFuture>> deleteDocuments(
final Collection> values,
- final Class type,
- final DocumentDeleteOptions options);
+ final DocumentDeleteOptions options,
+ final Class type);
/**
* Checks if the document exists by reading a single document head
diff --git a/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
index 90c9bfab0..3544d2298 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
@@ -46,35 +46,44 @@ public class ArangoCollectionAsyncImpl
}
@Override
- public CompletableFuture> insertDocument(final T value) {
- final DocumentCreateOptions options = new DocumentCreateOptions();
- return executor.execute(insertDocumentRequest(value, options),
- constructParametricType(DocumentCreateEntity.class, value.getClass()));
+ public CompletableFuture> insertDocument(final Object value) {
+ return executor.execute(insertDocumentRequest(value, new DocumentCreateOptions()),
+ constructParametricType(DocumentCreateEntity.class, Void.class));
}
@Override
+ @SuppressWarnings("unchecked")
public CompletableFuture> insertDocument(
final T value,
final DocumentCreateOptions options) {
+ return insertDocument(value, options, (Class) value.getClass());
+ }
+
+ @Override
+ public CompletableFuture> insertDocument(T value, DocumentCreateOptions options, Class type) {
return executor.execute(insertDocumentRequest(value, options),
- constructParametricType(DocumentCreateEntity.class, value.getClass()));
+ constructParametricType(DocumentCreateEntity.class, type));
}
@Override
- public CompletableFuture>> insertDocuments(
- final Collection values) {
- final DocumentCreateOptions params = new DocumentCreateOptions();
- return executor.execute(insertDocumentsRequest(values, params),
- insertDocumentsResponseDeserializer(values, params));
+ public CompletableFuture>> insertDocuments(
+ final Collection> values) {
+ return executor
+ .execute(insertDocumentsRequest(values, new DocumentCreateOptions()), insertDocumentsResponseDeserializer(Void.class));
}
@Override
+ @SuppressWarnings("unchecked")
public CompletableFuture>> insertDocuments(
final Collection values,
final DocumentCreateOptions options) {
- final DocumentCreateOptions params = (options != null ? options : new DocumentCreateOptions());
- return executor.execute(insertDocumentsRequest(values, params),
- insertDocumentsResponseDeserializer(values, params));
+ return insertDocuments(values, options, (Class) getCollectionContentClass(values));
+ }
+
+ @Override
+ public CompletableFuture>> insertDocuments(Collection values, DocumentCreateOptions options, Class type) {
+ return executor
+ .execute(insertDocumentsRequest(values, options), insertDocumentsResponseDeserializer(type));
}
@Override
@@ -134,41 +143,49 @@ public CompletableFuture> getDocuments(
}
@Override
- public CompletableFuture> replaceDocument(final String key, final T value) {
+ public CompletableFuture> replaceDocument(final String key, final Object value) {
final DocumentReplaceOptions options = new DocumentReplaceOptions();
return executor.execute(replaceDocumentRequest(key, value, options),
- constructParametricType(DocumentUpdateEntity.class, value.getClass()));
+ constructParametricType(DocumentUpdateEntity.class, Void.class));
}
@Override
+ @SuppressWarnings("unchecked")
public CompletableFuture> replaceDocument(
final String key,
final T value,
final DocumentReplaceOptions options) {
+ return replaceDocument(key, value, options, (Class) value.getClass());
+ }
+
+ @Override
+ public CompletableFuture> replaceDocument(String key, T value, DocumentReplaceOptions options, Class type) {
return executor.execute(replaceDocumentRequest(key, value, options),
- constructParametricType(DocumentUpdateEntity.class, value.getClass()));
+ constructParametricType(DocumentUpdateEntity.class, type));
}
@Override
- public CompletableFuture>> replaceDocuments(
- final Collection values) {
- final DocumentReplaceOptions params = new DocumentReplaceOptions();
- return executor.execute(replaceDocumentsRequest(values, params),
- replaceDocumentsResponseDeserializer(values));
+ public CompletableFuture>> replaceDocuments(
+ final Collection> values) {
+ return executor.execute(replaceDocumentsRequest(values, new DocumentReplaceOptions()), replaceDocumentsResponseDeserializer(Void.class));
}
@Override
+ @SuppressWarnings("unchecked")
public CompletableFuture>> replaceDocuments(
final Collection values,
final DocumentReplaceOptions options) {
- final DocumentReplaceOptions params = (options != null ? options : new DocumentReplaceOptions());
- return executor.execute(replaceDocumentsRequest(values, params),
- replaceDocumentsResponseDeserializer(values));
+ return replaceDocuments(values, options, (Class) getCollectionContentClass(values));
}
@Override
- public CompletableFuture> updateDocument(final String key, final T value) {
- return updateDocument(key, value, new DocumentUpdateOptions());
+ public CompletableFuture>> replaceDocuments(Collection values, DocumentReplaceOptions options, Class type) {
+ return executor.execute(replaceDocumentsRequest(values, options), replaceDocumentsResponseDeserializer(type));
+ }
+
+ @Override
+ public CompletableFuture> updateDocument(final String key, final Object value) {
+ return updateDocument(key, value, new DocumentUpdateOptions(), Void.class);
}
@Override
@@ -191,9 +208,9 @@ public CompletableFuture> updateDocument(
}
@Override
- public CompletableFuture>> updateDocuments(
- final Collection values) {
- return updateDocuments(values, new DocumentUpdateOptions());
+ public CompletableFuture>> updateDocuments(
+ final Collection> values) {
+ return updateDocuments(values, new DocumentUpdateOptions(), Void.class);
}
@Override
@@ -201,7 +218,7 @@ public CompletableFuture>> updat
public CompletableFuture>> updateDocuments(
final Collection values,
final DocumentUpdateOptions options) {
- return updateDocuments(values, options, values.isEmpty() ? null : (Class) getCollectionContentClass(values));
+ return updateDocuments(values, options, (Class) getCollectionContentClass(values));
}
@Override
@@ -209,22 +226,26 @@ public CompletableFuture>> up
final Collection values,
final DocumentUpdateOptions options,
final Class returnType) {
- final DocumentUpdateOptions params = (options != null ? options : new DocumentUpdateOptions());
- return executor.execute(updateDocumentsRequest(values, params),
- updateDocumentsResponseDeserializer(returnType));
+ return executor
+ .execute(updateDocumentsRequest(values, options), updateDocumentsResponseDeserializer(returnType));
}
@Override
public CompletableFuture> deleteDocument(final String key) {
- return executor.execute(deleteDocumentRequest(key, new DocumentDeleteOptions()),
- constructParametricType(DocumentDeleteEntity.class, Void.class));
+ return deleteDocument(key, new DocumentDeleteOptions());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public CompletableFuture> deleteDocument(String key, DocumentDeleteOptions options) {
+ return deleteDocument(key, options, (Class) Void.class);
}
@Override
public CompletableFuture> deleteDocument(
final String key,
- final Class type,
- final DocumentDeleteOptions options) {
+ final DocumentDeleteOptions options,
+ final Class type) {
return executor.execute(deleteDocumentRequest(key, options),
constructParametricType(DocumentDeleteEntity.class, type));
}
@@ -232,15 +253,20 @@ public CompletableFuture> deleteDocument(
@Override
public CompletableFuture>> deleteDocuments(
final Collection> values) {
- return executor.execute(deleteDocumentsRequest(values, new DocumentDeleteOptions()),
- deleteDocumentsResponseDeserializer(Void.class));
+ return deleteDocuments(values, new DocumentDeleteOptions(), Void.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public CompletableFuture>> deleteDocuments(Collection> values, DocumentDeleteOptions options) {
+ return deleteDocuments(values, options, (Class) getCollectionContentClass(values));
}
@Override
public