Class 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 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 state
        etag - - 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.
      • State

        public State​(String key,
                     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 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object