-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #236
- Loading branch information
Showing
34 changed files
with
626 additions
and
29 deletions.
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
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
36 changes: 36 additions & 0 deletions
36
src/main/java/io/tarantool/driver/api/space/options/OperationWithFieldsOptions.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,36 @@ | ||
package io.tarantool.driver.api.space.options; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Base interface for all operation options that may have a configurable return. | ||
* | ||
* @author Artyom Dubinin | ||
*/ | ||
public interface OperationWithFieldsOptions<T extends OperationWithFieldsOptions<T>> | ||
extends Options, Self<T> { | ||
|
||
String FIELDS = "fields"; | ||
|
||
/** | ||
* Specifies list of fields names for getting only a subset of fields. | ||
* By default, all fields are returned. | ||
* | ||
* @param fields list of string field names | ||
* @return this options instance | ||
*/ | ||
default T withFields(List<String> fields) { | ||
addOption(FIELDS, fields); | ||
return self(); | ||
} | ||
|
||
/** | ||
* Return list of fields names for getting only a subset of fields. | ||
* | ||
* @return list of fields string names | ||
*/ | ||
default Optional<List> getFields() { | ||
return getOption(FIELDS, List.class); | ||
} | ||
} |
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
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
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
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
47 changes: 47 additions & 0 deletions
47
src/main/java/io/tarantool/driver/core/proxy/CRUDDeleteOptions.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,47 @@ | ||
package io.tarantool.driver.core.proxy; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* This class is not part of the public API. | ||
* <p> | ||
* Represent options for cluster delete operation. | ||
* | ||
* @author Alexey Kuzin | ||
* @author Artyom Dubinin | ||
*/ | ||
class CRUDDeleteOptions extends CRUDBucketIdOptions { | ||
|
||
public static final String FIELDS = "fields"; | ||
|
||
protected <O extends CRUDDeleteOptions, B extends AbstractBuilder<O, B>> | ||
CRUDDeleteOptions(CRUDDeleteOptions.AbstractBuilder<O, B> builder) { | ||
super(builder); | ||
addOption(FIELDS, builder.fields); | ||
} | ||
|
||
protected abstract static | ||
class AbstractBuilder<O extends CRUDDeleteOptions, B extends AbstractBuilder<O, B>> | ||
extends CRUDBucketIdOptions.AbstractBuilder<O, B> { | ||
private Optional<List> fields = Optional.empty(); | ||
|
||
public B withFields(Optional<List> fields) { | ||
this.fields = fields; | ||
return self(); | ||
} | ||
} | ||
|
||
protected static final class Builder extends AbstractBuilder<CRUDDeleteOptions, Builder> { | ||
|
||
@Override | ||
CRUDDeleteOptions.Builder self() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public CRUDDeleteOptions build() { | ||
return new CRUDDeleteOptions(this); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/io/tarantool/driver/core/proxy/CRUDInsertOptions.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,47 @@ | ||
package io.tarantool.driver.core.proxy; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* This class is not part of the public API. | ||
* <p> | ||
* Represent options for cluster insert operation. | ||
* | ||
* @author Alexey Kuzin | ||
* @author Artyom Dubinin | ||
*/ | ||
class CRUDInsertOptions extends CRUDBucketIdOptions { | ||
|
||
public static final String FIELDS = "fields"; | ||
|
||
protected <O extends CRUDInsertOptions, B extends AbstractBuilder<O, B>> | ||
CRUDInsertOptions(CRUDInsertOptions.AbstractBuilder<O, B> builder) { | ||
super(builder); | ||
addOption(FIELDS, builder.fields); | ||
} | ||
|
||
protected abstract static | ||
class AbstractBuilder<O extends CRUDInsertOptions, B extends AbstractBuilder<O, B>> | ||
extends CRUDBucketIdOptions.AbstractBuilder<O, B> { | ||
private Optional<List> fields = Optional.empty(); | ||
|
||
public B withFields(Optional<List> fields) { | ||
this.fields = fields; | ||
return self(); | ||
} | ||
} | ||
|
||
protected static final class Builder extends AbstractBuilder<CRUDInsertOptions, Builder> { | ||
|
||
@Override | ||
CRUDInsertOptions.Builder self() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public CRUDInsertOptions build() { | ||
return new CRUDInsertOptions(this); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/io/tarantool/driver/core/proxy/CRUDReplaceOptions.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,47 @@ | ||
package io.tarantool.driver.core.proxy; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* This class is not part of the public API. | ||
* <p> | ||
* Represent options for cluster replace operation. | ||
* | ||
* @author Alexey Kuzin | ||
* @author Artyom Dubinin | ||
*/ | ||
class CRUDReplaceOptions extends CRUDBucketIdOptions { | ||
|
||
public static final String FIELDS = "fields"; | ||
|
||
protected <O extends CRUDReplaceOptions, B extends AbstractBuilder<O, B>> | ||
CRUDReplaceOptions(CRUDReplaceOptions.AbstractBuilder<O, B> builder) { | ||
super(builder); | ||
addOption(FIELDS, builder.fields); | ||
} | ||
|
||
protected abstract static | ||
class AbstractBuilder<O extends CRUDReplaceOptions, B extends AbstractBuilder<O, B>> | ||
extends CRUDBucketIdOptions.AbstractBuilder<O, B> { | ||
private Optional<List> fields = Optional.empty(); | ||
|
||
public B withFields(Optional<List> fields) { | ||
this.fields = fields; | ||
return self(); | ||
} | ||
} | ||
|
||
protected static final class Builder extends AbstractBuilder<CRUDReplaceOptions, Builder> { | ||
|
||
@Override | ||
CRUDReplaceOptions.Builder self() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public CRUDReplaceOptions build() { | ||
return new CRUDReplaceOptions(this); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/tarantool/driver/core/proxy/CRUDReturnOptions.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,48 @@ | ||
package io.tarantool.driver.core.proxy; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* This class is not part of the public API. | ||
* <p> | ||
* Represent returned options for cluster proxy operations. | ||
* The return set of fields of the tuples can be specified. | ||
* | ||
* @author Alexey Kuzin | ||
* @author Artyom Dubinin | ||
*/ | ||
class CRUDReturnOptions extends CRUDBaseOptions { | ||
|
||
public static final String FIELDS = "fields"; | ||
|
||
protected <O extends CRUDReturnOptions, B extends AbstractBuilder<O, B>> | ||
CRUDReturnOptions(CRUDReturnOptions.AbstractBuilder<O, B> builder) { | ||
super(builder); | ||
addOption(FIELDS, builder.fields); | ||
} | ||
|
||
protected abstract static | ||
class AbstractBuilder<O extends CRUDReturnOptions, B extends AbstractBuilder<O, B>> | ||
extends CRUDBaseOptions.AbstractBuilder<O, B> { | ||
private Optional<List> fields = Optional.empty(); | ||
|
||
public B withFields(Optional<List> fields) { | ||
this.fields = fields; | ||
return self(); | ||
} | ||
} | ||
|
||
protected static final class Builder extends AbstractBuilder<CRUDReturnOptions, Builder> { | ||
|
||
@Override | ||
CRUDReturnOptions.Builder self() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public CRUDReturnOptions build() { | ||
return new CRUDReturnOptions(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.