-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3120fb2
commit f948cde
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...document/src/main/java/org/jnosql/diana/document/query/DefaultDocumentDeleteProvider.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,25 @@ | ||
package org.jnosql.diana.document.query; | ||
|
||
import jakarta.nosql.document.DocumentDeleteQuery.DocumentDelete; | ||
import jakarta.nosql.document.DocumentDeleteQuery.DocumentDeleteProvider; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Objects; | ||
import java.util.stream.Stream; | ||
|
||
public final class DefaultDocumentDeleteProvider implements DocumentDeleteProvider { | ||
|
||
@Override | ||
public DocumentDelete apply(String[] documents) { | ||
if(Stream.of(documents).anyMatch(Objects::isNull)) { | ||
throw new NullPointerException("there is null document in the query"); | ||
} | ||
return new DefaultDeleteQueryBuilder(Arrays.asList(documents)); | ||
} | ||
|
||
@Override | ||
public DocumentDelete get() { | ||
return new DefaultDeleteQueryBuilder(Collections.emptyList()); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...document/src/main/java/org/jnosql/diana/document/query/DefaultDocumentSelectProvider.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,44 @@ | ||
/* | ||
* | ||
* Copyright (c) 2019 Otávio Santana and others | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
* | ||
*/ | ||
package org.jnosql.diana.document.query; | ||
|
||
import jakarta.nosql.document.DocumentQuery.DocumentSelect; | ||
import jakarta.nosql.document.DocumentQuery.DocumentSelectProvider; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Objects; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* The default implementation of {@link DocumentSelectProvider} | ||
*/ | ||
public final class DefaultDocumentSelectProvider implements DocumentSelectProvider { | ||
|
||
@Override | ||
public DocumentSelect apply(String[] documents) { | ||
if(Stream.of(documents).anyMatch(Objects::isNull)) { | ||
throw new NullPointerException("there is null document in the query"); | ||
} | ||
return new DefaultSelectQueryBuilder(Arrays.asList(documents)); | ||
} | ||
|
||
@Override | ||
public DocumentSelect get() { | ||
return new DefaultSelectQueryBuilder(Collections.emptyList()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...urces/META-INF/services/jakarta.nosql.document.DocumentDeleteQuery$DocumentDeleteProvider
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 |
---|---|---|
@@ -1 +1 @@ | ||
org.jnosql.diana.document.query.DefaultDocumentDeleteSupplier | ||
org.jnosql.diana.document.query.DefaultDocumentDeleteProvider |