diff --git a/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageItemType.java b/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageItemType.java new file mode 100644 index 00000000..08befffc --- /dev/null +++ b/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageItemType.java @@ -0,0 +1,13 @@ +package momento.sdk.responses.storage; + +/** Type of item in a store. */ +public enum StorageItemType { + /** Item is a byte array. */ + BYTE_ARRAY, + /** Item is a string. */ + STRING, + /** Item is a long. */ + LONG, + /** Item is a double. */ + DOUBLE +} diff --git a/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageValue.java b/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageValue.java index 741e490d..07d99e30 100644 --- a/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageValue.java +++ b/momento-sdk/src/main/java/momento/sdk/responses/storage/StorageValue.java @@ -4,56 +4,56 @@ public class StorageValue { private final Object value; - private final ValueType valueType; + private final StorageItemType itemType; - private StorageValue(Object value, ValueType valueType) { + private StorageValue(Object value, StorageItemType itemType) { this.value = value; - this.valueType = valueType; + this.itemType = itemType; } public static StorageValue of(byte[] value) { - return new StorageValue(value, ValueType.BYTE_ARRAY); + return new StorageValue(value, StorageItemType.BYTE_ARRAY); } public static StorageValue of(String value) { - return new StorageValue(value, ValueType.STRING); + return new StorageValue(value, StorageItemType.STRING); } public static StorageValue of(long value) { - return new StorageValue(value, ValueType.LONG); + return new StorageValue(value, StorageItemType.LONG); } public static StorageValue of(double value) { - return new StorageValue(value, ValueType.DOUBLE); + return new StorageValue(value, StorageItemType.DOUBLE); } - public ValueType getType() { - return valueType; + public StorageItemType getType() { + return itemType; } public Optional getByteArray() { - if (valueType != ValueType.BYTE_ARRAY) { + if (itemType != StorageItemType.BYTE_ARRAY) { return Optional.empty(); } return Optional.of((byte[]) value); } public Optional getString() { - if (valueType != ValueType.STRING) { + if (itemType != StorageItemType.STRING) { return Optional.empty(); } return Optional.of((String) value); } public Optional getLong() { - if (valueType != ValueType.LONG) { + if (itemType != StorageItemType.LONG) { return Optional.empty(); } return Optional.of((long) value); } public Optional getDouble() { - if (valueType != ValueType.DOUBLE) { + if (itemType != StorageItemType.DOUBLE) { return Optional.empty(); } return Optional.of((double) value); diff --git a/momento-sdk/src/main/java/momento/sdk/responses/storage/ValueType.java b/momento-sdk/src/main/java/momento/sdk/responses/storage/ValueType.java deleted file mode 100644 index 4a4fadaa..00000000 --- a/momento-sdk/src/main/java/momento/sdk/responses/storage/ValueType.java +++ /dev/null @@ -1,13 +0,0 @@ -package momento.sdk.responses.storage; - -/** Type of value in a store. */ -public enum ValueType { - /** Value is a byte array. */ - BYTE_ARRAY, - /** Value is a string. */ - STRING, - /** Value is a long. */ - LONG, - /** Value is a double. */ - DOUBLE -}