Package io.dapr.client.domain
Class State<T>
- java.lang.Object
-
- io.dapr.client.domain.State<T>
-
- Type Parameters:
T
- The type of the value of the sate
public class State<T> extends Object
This class reprent what a State is.
-
-
Constructor Summary
Constructors Constructor Description State(String key)
Create an immutable state reference to be retrieved or deleted.State(String key, String error)
Create an immutable state.State(String key, String etag, StateOptions options)
Create an immutable state reference to be retrieved or deleted.State(String key, T value, String etag)
Create an immutable state.State(String key, T value, String etag, StateOptions options)
Create an immutable state.State(String key, T value, String etag, Map<String,String> metadata, StateOptions options)
Create an immutable state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getError()
Retrieve the error for this state.String
getEtag()
Retrieve the ETag of this state.String
getKey()
Retrieves the Key of the state.Map<String,String>
getMetadata()
Retrieve the metadata of this state.StateOptions
getOptions()
Retrieve the Options used for saving the state.T
getValue()
Retrieves the Value of the state.int
hashCode()
String
toString()
-
-
-
Constructor Detail
-
State
public State(String key)
Create an immutable state reference to be retrieved or deleted. This Constructor CAN be used anytime you need to retrieve or delete a state.- Parameters:
key
- - The key of the state
-
State
public State(String key, String etag, StateOptions options)
Create an immutable state reference to be retrieved or deleted. This Constructor CAN be used anytime you need to retrieve or delete a state.- Parameters:
key
- - The key of the stateetag
- - The etag of the state - Keep in mind that for some state stores (like redis) only numbers are supported.options
- - REQUIRED when saving a state.
-
State
public State(String key, T value, String etag, StateOptions options)
Create an immutable state. This Constructor CAN be used anytime you want the state to be saved.- Parameters:
key
- - The key of the state.value
- - The value of the state.etag
- - The etag of the state - for some state stores (like redis) only numbers are supported.options
- - REQUIRED when saving a state.
-
State
public State(String key, T value, String etag, Map<String,String> metadata, StateOptions options)
Create an immutable state. This Constructor CAN be used anytime you want the state to be saved.- Parameters:
key
- - The key of the state.value
- - The value of the state.etag
- - The etag of the state - for some state stores (like redis) only numbers are supported.metadata
- - The metadata of the state.options
- - REQUIRED when saving a state.
-
State
public State(String key, T value, String etag)
Create an immutable state. This Constructor CAN be used anytime you want the state to be saved.- Parameters:
key
- - The key of the state.value
- - The value of the state.etag
- - The etag of the state - some state stores (like redis) only numbers are supported.
-
-
Method Detail
-
getValue
public T getValue()
Retrieves the Value of the state.- Returns:
- The value of the state
-
getKey
public String getKey()
Retrieves the Key of the state.- Returns:
- The key of the state
-
getEtag
public String getEtag()
Retrieve the ETag of this state.- Returns:
- The etag of the state
-
getMetadata
public Map<String,String> getMetadata()
Retrieve the metadata of this state.- Returns:
- the metadata of this state
-
getError
public String getError()
Retrieve the error for this state.- Returns:
- The error for this state.
-
getOptions
public StateOptions getOptions()
Retrieve the Options used for saving the state.- Returns:
- The options to save the state
-
-