Package com.microsoft.kiota.store
Interface BackingStore
- All Known Implementing Classes:
InMemoryBackingStore
public interface BackingStore
Stores model information in a different location than the object properties. Implementations can provide dirty tracking capabilities, caching capabilities or integration with 3rd party stores.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the data stored in the backing store.Enumerates all the values stored in the backing store.Enumerates the keys for all values that changed to null.<T> TGets a value from the backing store based on its key.booleanGets whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed.booleanGets whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods.<T> voidSets or updates the stored value for the given key.voidsetIsInitializationCompleted(boolean value) Sets whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed.voidsetReturnOnlyChangedValues(boolean value) Sets whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods.subscribe(TriConsumer<String, Object, Object> callback) Creates a subscription to any data change happening.voidCreates a subscription to any data change happening, allowing to specify the subscription Id.voidunsubscribe(String subscriptionId) Removes a subscription from the store based on its subscription id.
-
Method Details
-
get
Gets a value from the backing store based on its key. Returns null if the value hasn't changed and "ReturnOnlyChangedValues" is true.- Type Parameters:
T- The type of the value to be retrieved.- Parameters:
key- The key to lookup the backing store with.- Returns:
- The value from the backing store.
-
set
Sets or updates the stored value for the given key. Will trigger subscriptions callbacks.- Type Parameters:
T- The type of the value to be stored.- Parameters:
key- The key to store and retrieve the information.value- The value to be stored.
-
enumerate
Enumerates all the values stored in the backing store. Values will be filtered if "ReturnOnlyChangedValues" is true.- Returns:
- The values available in the backing store.
-
enumerateKeysForValuesChangedToNull
Enumerates the keys for all values that changed to null.- Returns:
- The keys for the values that changed to null.
-
subscribe
Creates a subscription to any data change happening.- Parameters:
callback- Callback to be invoked on data changes where the first parameter is the data key, the second the previous value and the third the new value.- Returns:
- The subscription Id to use when removing the subscription
-
subscribe
Creates a subscription to any data change happening, allowing to specify the subscription Id.- Parameters:
subscriptionId- The subscription Id to use.callback- Callback to be invoked on data changes where the first parameter is the data key, the second the previous value and the third the new value.
-
unsubscribe
Removes a subscription from the store based on its subscription id.- Parameters:
subscriptionId- The Id of the subscription to remove.
-
clear
void clear()Clears the data stored in the backing store. Doesn't trigger any subscription. -
setIsInitializationCompleted
void setIsInitializationCompleted(boolean value) Sets whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed.- Parameters:
value- value to set
-
getIsInitializationCompleted
boolean getIsInitializationCompleted()Gets whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed.- Returns:
- Whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed.
-
setReturnOnlyChangedValues
void setReturnOnlyChangedValues(boolean value) Sets whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods.- Parameters:
value- value to set
-
getReturnOnlyChangedValues
boolean getReturnOnlyChangedValues()Gets whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods.- Returns:
- Whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods.
-