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 java.lang.Object
This class reprent what a State is.
-
Constructor Summary
Constructors Constructor Description State(java.lang.String key)
Create an immutable state reference to be retrieved or deleted.State(java.lang.String key, java.lang.String error)
Create an immutable state.State(java.lang.String key, java.lang.String etag, StateOptions options)
Create an immutable state reference to be retrieved or deleted.State(T value, java.lang.String key, java.lang.String etag)
Create an immutable state.State(T value, java.lang.String key, java.lang.String etag, StateOptions options)
Create an immutable state. -
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getError()
Retrieve the error for this state.java.lang.String
getEtag()
Retrieve the ETag of this state.java.lang.String
getKey()
Retrieves the Key of the state.StateOptions
getOptions()
Retrieve the Options used for saving the state.T
getValue()
Retrieves the Value of the state.int
hashCode()
java.lang.String
toString()
-
Constructor Details
-
State
public State(java.lang.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
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
Create an immutable state. This Constructor CAN be used anytime you want the state to be saved.- Parameters:
value
- - The value of the state.key
- - The key 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
Create an immutable state. This Constructor CAN be used anytime you want the state to be saved.- Parameters:
value
- - The value of the state.key
- - The key of the state.etag
- - The etag of the state - some state stores (like redis) only numbers are supported.
-
State
public State(java.lang.String key, java.lang.String error)Create an immutable state. This Constructor MUST be used anytime the key could not be retrieved and contains an error.- Parameters:
key
- - The key of the state.error
- - Error when fetching the state.
-
-
Method Details
-
getValue
Retrieves the Value of the state.- Returns:
- The value of the state
-
getKey
public java.lang.String getKey()Retrieves the Key of the state.- Returns:
- The key of the state
-
getEtag
public java.lang.String getEtag()Retrieve the ETag of this state.- Returns:
- The etag of the state
-
getError
public java.lang.String getError()Retrieve the error for this state.- Returns:
- The error for this state.
-
getOptions
Retrieve the Options used for saving the state.- Returns:
- The options to save the state
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-