File tree Expand file tree Collapse file tree 14 files changed +228
-28
lines changed
main/java/org/springframework/data/couchbase/core
test/java/org/springframework/data/couchbase/domain Expand file tree Collapse file tree 14 files changed +228
-28
lines changed Original file line number Diff line number Diff line change @@ -26,29 +26,32 @@ public interface ExecutableInsertByIdOperation {
26
26
27
27
<T > ExecutableInsertById <T > insertById (Class <T > domainType );
28
28
29
- interface TerminatingInsertById <T > {
29
+ interface TerminatingInsertById <T > extends OneAndAll < T > {
30
30
31
+ @ Override
31
32
T one (T object );
32
33
34
+ @ Override
33
35
Collection <? extends T > all (Collection <? extends T > objects );
34
36
35
37
}
36
38
37
- interface InsertByIdWithCollection <T > extends TerminatingInsertById <T > {
39
+ interface InsertByIdWithCollection <T > extends TerminatingInsertById <T >, InCollection < T > {
38
40
39
41
TerminatingInsertById <T > inCollection (String collection );
40
42
}
41
43
42
- interface InsertByIdWithDurability <T > extends InsertByIdWithCollection <T > {
44
+ interface InsertByIdWithDurability <T > extends InsertByIdWithCollection <T >, WithDurability < T > {
43
45
44
46
InsertByIdWithCollection <T > withDurability (DurabilityLevel durabilityLevel );
45
47
46
48
InsertByIdWithCollection <T > withDurability (PersistTo persistTo , ReplicateTo replicateTo );
47
49
48
50
}
49
51
50
- interface InsertByIdWithExpiry <T > extends InsertByIdWithDurability <T > {
52
+ interface InsertByIdWithExpiry <T > extends InsertByIdWithDurability <T >, WithExpiry < T > {
51
53
54
+ @ Override
52
55
InsertByIdWithDurability <T > withExpiry (Duration expiry );
53
56
}
54
57
Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ interface TerminatingRemoveById {
34
34
35
35
}
36
36
37
- interface RemoveByIdWithCollection extends TerminatingRemoveById {
37
+ interface RemoveByIdWithCollection extends TerminatingRemoveById , InCollection {
38
38
39
39
TerminatingRemoveById inCollection (String collection );
40
40
}
41
41
42
- interface RemoveByIdWithDurability extends RemoveByIdWithCollection {
42
+ interface RemoveByIdWithDurability extends RemoveByIdWithCollection , WithDurability {
43
43
44
44
RemoveByIdWithCollection withDurability (DurabilityLevel durabilityLevel );
45
45
Original file line number Diff line number Diff line change 19
19
import java .util .Collection ;
20
20
21
21
import com .couchbase .client .core .msg .kv .DurabilityLevel ;
22
+ import com .couchbase .client .java .kv .IncrementOptions ;
22
23
import com .couchbase .client .java .kv .PersistTo ;
23
24
import com .couchbase .client .java .kv .ReplicateTo ;
24
25
25
26
public interface ExecutableReplaceByIdOperation {
26
27
27
28
<T > ExecutableReplaceById <T > replaceById (Class <T > domainType );
28
29
29
- interface TerminatingReplaceById <T > {
30
+ interface TerminatingReplaceById <T > extends OneAndAll < T > {
30
31
32
+ @ Override
31
33
T one (T object );
32
34
35
+ @ Override
33
36
Collection <? extends T > all (Collection <? extends T > objects );
34
37
35
38
}
36
39
37
- interface ReplaceByIdWithCollection <T > extends TerminatingReplaceById <T > {
40
+ interface ReplaceByIdWithCollection <T > extends TerminatingReplaceById <T > , InCollection < T > {
38
41
39
42
TerminatingReplaceById <T > inCollection (String collection );
40
43
}
41
44
42
- interface ReplaceByIdWithDurability <T > extends ReplaceByIdWithCollection <T > {
45
+ interface ReplaceByIdWithDurability <T > extends ReplaceByIdWithCollection <T >, WithDurability < T > {
43
46
44
47
ReplaceByIdWithCollection <T > withDurability (DurabilityLevel durabilityLevel );
45
48
46
49
ReplaceByIdWithCollection <T > withDurability (PersistTo persistTo , ReplicateTo replicateTo );
47
50
48
51
}
49
52
50
- interface ReplaceByIdWithExpiry <T > extends ReplaceByIdWithDurability <T > {
53
+ interface ReplaceByIdWithExpiry <T > extends ReplaceByIdWithDurability <T >, WithExpiry < T > {
51
54
55
+ @ Override
52
56
ReplaceByIdWithDurability <T > withExpiry (final Duration expiry );
53
57
}
54
58
Original file line number Diff line number Diff line change @@ -26,29 +26,32 @@ public interface ExecutableUpsertByIdOperation {
26
26
27
27
<T > ExecutableUpsertById <T > upsertById (Class <T > domainType );
28
28
29
- interface TerminatingUpsertById <T > {
29
+ interface TerminatingUpsertById <T > extends OneAndAll < T > {
30
30
31
+ @ Override
31
32
T one (T object );
32
33
34
+ @ Override
33
35
Collection <? extends T > all (Collection <? extends T > objects );
34
36
35
37
}
36
38
37
- interface UpsertByIdWithCollection <T > extends TerminatingUpsertById <T > {
39
+ interface UpsertByIdWithCollection <T > extends TerminatingUpsertById <T >, InCollection < T > {
38
40
39
41
TerminatingUpsertById <T > inCollection (String collection );
40
42
}
41
43
42
- interface UpsertByIdWithDurability <T > extends UpsertByIdWithCollection <T > {
44
+ interface UpsertByIdWithDurability <T > extends UpsertByIdWithCollection <T >, WithDurability < T > {
43
45
44
46
UpsertByIdWithCollection <T > withDurability (DurabilityLevel durabilityLevel );
45
47
46
48
UpsertByIdWithCollection <T > withDurability (PersistTo persistTo , ReplicateTo replicateTo );
47
49
48
50
}
49
51
50
- interface UpsertByIdWithExpiry <T > extends UpsertByIdWithDurability <T > {
52
+ interface UpsertByIdWithExpiry <T > extends UpsertByIdWithDurability <T >, WithExpiry < T > {
51
53
54
+ @ Override
52
55
UpsertByIdWithDurability <T > withExpiry (Duration expiry );
53
56
}
54
57
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2020 the original author or authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package org .springframework .data .couchbase .core ;
17
+
18
+ /**
19
+ * A common interface for all of Insert, Replace, Upsert that take collection
20
+ *
21
+ * @author Michael Reiche
22
+ * @param <T> - the entity class
23
+ */
24
+ public interface InCollection <T > {
25
+ Object inCollection (String collection );
26
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2020 the original author or authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package org .springframework .data .couchbase .core ;
17
+
18
+ import java .util .Collection ;
19
+
20
+ /**
21
+ * A common interface for all of Insert, Replace, Upsert
22
+ *
23
+ * @author Michael Reiche
24
+ *
25
+ * @param <T> - the entity class
26
+ */
27
+ public interface OneAndAll <T > {
28
+
29
+ T one (T object );
30
+
31
+ Collection <? extends T > all (Collection <? extends T > objects );
32
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2020 the original author or authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package org .springframework .data .couchbase .core ;
17
+
18
+ import reactor .core .publisher .Flux ;
19
+ import reactor .core .publisher .Mono ;
20
+
21
+ import java .util .Collection ;
22
+
23
+ /**
24
+ * A common interface for all of Insert, Replace, Upsert
25
+ *
26
+ * @author Michael Reiche
27
+ * @param <T> - the entity class
28
+ */
29
+
30
+ public interface OneAndAllReactive <T > {
31
+ Mono <T > one (T object );
32
+
33
+ Flux <? extends T > all (Collection <? extends T > objects );
34
+ }
Original file line number Diff line number Diff line change @@ -29,28 +29,28 @@ public interface ReactiveInsertByIdOperation {
29
29
30
30
<T > ReactiveInsertById <T > insertById (Class <T > domainType );
31
31
32
- interface TerminatingInsertById <T > {
32
+ interface TerminatingInsertById <T > extends OneAndAllReactive < T > {
33
33
34
34
Mono <T > one (T object );
35
35
36
36
Flux <? extends T > all (Collection <? extends T > objects );
37
37
38
38
}
39
39
40
- interface InsertByIdWithCollection <T > extends TerminatingInsertById <T > {
40
+ interface InsertByIdWithCollection <T > extends TerminatingInsertById <T >, InCollection < T > {
41
41
42
42
TerminatingInsertById <T > inCollection (String collection );
43
43
}
44
44
45
- interface InsertByIdWithDurability <T > extends InsertByIdWithCollection <T > {
45
+ interface InsertByIdWithDurability <T > extends InsertByIdWithCollection <T >, WithDurability < T > {
46
46
47
47
InsertByIdWithCollection <T > withDurability (DurabilityLevel durabilityLevel );
48
48
49
49
InsertByIdWithCollection <T > withDurability (PersistTo persistTo , ReplicateTo replicateTo );
50
50
51
51
}
52
52
53
- interface InsertByIdWithExpiry <T > extends InsertByIdWithDurability <T > {
53
+ interface InsertByIdWithExpiry <T > extends InsertByIdWithDurability <T >, WithExpiry < T > {
54
54
55
55
InsertByIdWithDurability <T > withExpiry (Duration expiry );
56
56
}
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ interface TerminatingRemoveById {
36
36
37
37
}
38
38
39
- interface RemoveByIdWithCollection extends TerminatingRemoveById {
39
+ interface RemoveByIdWithCollection extends TerminatingRemoveById , InCollection {
40
40
41
41
TerminatingRemoveById inCollection (String collection );
42
42
}
43
43
44
- interface RemoveByIdWithDurability extends RemoveByIdWithCollection {
44
+ interface RemoveByIdWithDurability extends RemoveByIdWithCollection , WithDurability {
45
45
46
46
RemoveByIdWithCollection withDurability (DurabilityLevel durabilityLevel );
47
47
Original file line number Diff line number Diff line change @@ -29,28 +29,28 @@ public interface ReactiveReplaceByIdOperation {
29
29
30
30
<T > ReactiveReplaceById <T > replaceById (Class <T > domainType );
31
31
32
- interface TerminatingReplaceById <T > {
32
+ interface TerminatingReplaceById <T > extends OneAndAllReactive < T > {
33
33
34
34
Mono <T > one (T object );
35
35
36
36
Flux <? extends T > all (Collection <? extends T > objects );
37
37
38
38
}
39
39
40
- interface ReplaceByIdWithCollection <T > extends TerminatingReplaceById <T > {
40
+ interface ReplaceByIdWithCollection <T > extends TerminatingReplaceById <T >, InCollection < T > {
41
41
42
42
TerminatingReplaceById <T > inCollection (String collection );
43
43
}
44
44
45
- interface ReplaceByIdWithDurability <T > extends ReplaceByIdWithCollection <T > {
45
+ interface ReplaceByIdWithDurability <T > extends ReplaceByIdWithCollection <T >, WithDurability < T > {
46
46
47
47
ReplaceByIdWithCollection <T > withDurability (DurabilityLevel durabilityLevel );
48
48
49
49
ReplaceByIdWithCollection <T > withDurability (PersistTo persistTo , ReplicateTo replicateTo );
50
50
51
51
}
52
52
53
- interface ReplaceByIdWithExpiry <T > extends ReplaceByIdWithDurability <T > {
53
+ interface ReplaceByIdWithExpiry <T > extends ReplaceByIdWithDurability <T >, WithExpiry < T > {
54
54
55
55
ReplaceByIdWithDurability <T > withExpiry (final Duration expiry );
56
56
}
Original file line number Diff line number Diff line change @@ -29,28 +29,28 @@ public interface ReactiveUpsertByIdOperation {
29
29
30
30
<T > ReactiveUpsertById <T > upsertById (Class <T > domainType );
31
31
32
- interface TerminatingUpsertById <T > {
32
+ interface TerminatingUpsertById <T > extends OneAndAllReactive < T > {
33
33
34
34
Mono <T > one (T object );
35
35
36
36
Flux <? extends T > all (Collection <? extends T > objects );
37
37
38
38
}
39
39
40
- interface UpsertByIdWithCollection <T > extends TerminatingUpsertById <T > {
40
+ interface UpsertByIdWithCollection <T > extends TerminatingUpsertById <T >, InCollection < T > {
41
41
42
42
TerminatingUpsertById <T > inCollection (String collection );
43
43
}
44
44
45
- interface UpsertByIdWithDurability <T > extends UpsertByIdWithCollection <T > {
45
+ interface UpsertByIdWithDurability <T > extends UpsertByIdWithCollection <T >, WithDurability < T > {
46
46
47
47
UpsertByIdWithCollection <T > withDurability (DurabilityLevel durabilityLevel );
48
48
49
49
UpsertByIdWithCollection <T > withDurability (PersistTo persistTo , ReplicateTo replicateTo );
50
50
51
51
}
52
52
53
- interface UpsertByIdWithExpiry <T > extends UpsertByIdWithDurability <T > {
53
+ interface UpsertByIdWithExpiry <T > extends UpsertByIdWithDurability <T >, WithExpiry < T > {
54
54
55
55
UpsertByIdWithDurability <T > withExpiry (Duration expiry );
56
56
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2020 the original author or authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package org .springframework .data .couchbase .core ;
17
+
18
+ import com .couchbase .client .core .msg .kv .DurabilityLevel ;
19
+ import com .couchbase .client .java .kv .PersistTo ;
20
+ import com .couchbase .client .java .kv .ReplicateTo ;
21
+
22
+ /**
23
+ * A common interface for all of Insert, Replace, Upsert that take Durability
24
+ *
25
+ * @author Michael Reiche
26
+ * @param <T> - the entity class
27
+ */
28
+ public interface WithDurability <T > {
29
+ Object withDurability (DurabilityLevel durabilityLevel );
30
+
31
+ Object withDurability (PersistTo persistTo , ReplicateTo replicateTo );
32
+ }
You can’t perform that action at this time.
0 commit comments