-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Divide ClientUpdateOptions and ClientDeleteOptions #1593
Merged
Merged
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9e8f3ef
Divide ClientUpdateOptions and ClientDeleteOptions for operation-spec…
vbabanin 69c4f80
Change Javadoc.
vbabanin a520428
Add Base options to ensure consistency between API methods.
vbabanin 550ff7f
Fix static check issues.
vbabanin b69e443
Remove Nullable.
vbabanin c68bab4
Remove Sealed.
vbabanin 4a40ee5
Remove Base classes from Scala API consistency test.
vbabanin ce60885
Rename Assertions class.
vbabanin 25c8e8c
Make class final.
vbabanin f0f7ed3
Fix return type.
vbabanin 554345d
Add Api consistency exclusion.
vbabanin 374dff8
Rename classes.
vbabanin 3039e17
Make Options generic.
vbabanin d5bb017
Introduce `AbstractClientDeleteOptions`, `AbstractClientUpdateOptions`.
stIncMale bdb7e2f
Create explicit toString().
vbabanin 00eb61d
Rename outstanding replace option methods.
vbabanin 5b02b1c
Fix toString()
vbabanin 76b815b
Update driver-core/src/test/unit/com/mongodb/MongoBaseInterfaceAssert…
vbabanin 8d862ec
Update driver-core/src/main/com/mongodb/internal/client/model/bulk/Co…
vbabanin 2cc9abb
Update driver-core/src/main/com/mongodb/internal/client/model/bulk/Co…
vbabanin ac9e2b9
Remove package name as parameter.
vbabanin bda45a8
Add Javadoc.
vbabanin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
driver-core/src/main/com/mongodb/client/model/bulk/BaseClientDeleteOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2008-present MongoDB, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.mongodb.client.model.bulk; | ||
|
||
import com.mongodb.client.model.Collation; | ||
import com.mongodb.lang.Nullable; | ||
import org.bson.conversions.Bson; | ||
|
||
interface BaseClientDeleteOptions { | ||
|
||
BaseClientDeleteOptions collation(@Nullable Collation collation); | ||
|
||
BaseClientDeleteOptions hint(@Nullable Bson hint); | ||
|
||
BaseClientDeleteOptions hintString(@Nullable String hintString); | ||
} |
33 changes: 33 additions & 0 deletions
33
driver-core/src/main/com/mongodb/client/model/bulk/BaseClientUpdateOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2008-present MongoDB, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.mongodb.client.model.bulk; | ||
|
||
import com.mongodb.client.model.Collation; | ||
import com.mongodb.lang.Nullable; | ||
import org.bson.conversions.Bson; | ||
|
||
interface BaseClientUpdateOptions { | ||
|
||
BaseClientUpdateOptions arrayFilters(@Nullable Iterable<? extends Bson> arrayFilters); | ||
|
||
BaseClientUpdateOptions collation(@Nullable Collation collation); | ||
|
||
BaseClientUpdateOptions hint(@Nullable Bson hint); | ||
|
||
BaseClientUpdateOptions hintString(@Nullable String hintString); | ||
|
||
BaseClientUpdateOptions upsert(@Nullable Boolean upsert); | ||
} |
stIncMale marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
driver-core/src/main/com/mongodb/client/model/bulk/ClientDeleteOneOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2008-present MongoDB, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.mongodb.client.model.bulk; | ||
|
||
import com.mongodb.annotations.Sealed; | ||
import com.mongodb.client.model.Collation; | ||
import com.mongodb.internal.client.model.bulk.ConcreteClientDeleteOneOptions; | ||
import com.mongodb.lang.Nullable; | ||
import org.bson.conversions.Bson; | ||
|
||
/** | ||
* The options to apply when deleting a document. | ||
* | ||
* @since 5.3 | ||
*/ | ||
@Sealed | ||
public interface ClientDeleteOneOptions extends BaseClientDeleteOptions { | ||
/** | ||
* Creates the default options. | ||
* | ||
* @return The default options. | ||
*/ | ||
static ClientDeleteOneOptions clientDeleteOneOptions() { | ||
return new ConcreteClientDeleteOneOptions(); | ||
} | ||
|
||
/** | ||
* Sets the collation. | ||
* | ||
* @param collation The collation. {@code null} represents the server default. | ||
* @return {@code this}. | ||
*/ | ||
@Override | ||
ClientDeleteOneOptions collation(@Nullable Collation collation); | ||
|
||
/** | ||
* Sets the index specification, | ||
* {@code null}-ifies {@linkplain #hintString(String) hint string}. | ||
* | ||
* @param hint The index specification. {@code null} represents the server default. | ||
* @return {@code this}. | ||
*/ | ||
@Override | ||
ClientDeleteOneOptions hint(@Nullable Bson hint); | ||
|
||
/** | ||
* Sets the index name, | ||
* {@code null}-ifies {@linkplain #hint(Bson) hint}. | ||
* | ||
* @param hintString The index name. {@code null} represents the server default. | ||
* @return {@code this}. | ||
*/ | ||
@Override | ||
ClientDeleteOneOptions hintString(@Nullable String hintString); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional]
BaseClientWriteModelOptions
that declares them, and is a super-interface forBaseClientDeleteOptions
,BaseClientUpdateOptions
,ClientReplaceOptions
.upsert
is shared byBaseClientUpdateOptions
andClientReplaceOptions
. Do you think it makes sense to add something likeBaseClientUpsertableWriteModelOptions
, such that it's a supertype forBaseClientUpdateOptions
andClientReplaceOptions
?