Interface StateRequest


public interface StateRequest
Variant state request, as returned by Session.targetForState(State). Each state request must be completed with either commit(Object...) or fail(Object...) before this session can to target another state.
Since:
0.6
  • Method Details

    • getSession

      Session getSession()
      The Variant session which created with this request by calling Session.targetForState(State).
      Returns:
      An object of type Session. Never null.
      Since:
      0.6
    • getState

      State getState()
      The target State of this request, which was passed to Session.targetForState(State).
      Returns:
      An object of type State. Never null.
      Since:
      0.6
    • getStatus

      StateRequest.Status getStatus()
      The current status of this state request.
      Since:
      0.9
    • getResolvedStateVariant

      Optional<StateVariant> getResolvedStateVariant()
      The state variant to which this state request resolved at run time, if any. A state request can either resolve to a StateVariant, or have trivial resolution, when all live experiences returned by getLiveExperiences() are control experiences.
      Returns:
      The Optional containing the StateVariant object to which this request resolved, or empty if all live experiences on this state are control.
      Since:
      0.6
      See Also:
    • getResolvedParameters

      Map<String,String> getResolvedParameters()
      The resolved state parameters as an immutable map. In case of trivial resolution, resolved state parameters are the ones declared at the state level, if any. In the case of non-trivial resolution, the parameters declared at the StateVariant level override the likely-named state parameters declared at the state level.
      Returns:
      Immutable map keyed by parameter names. Never null, but may be empty.
      Since:
      0.7
    • getLiveExperiences

      Set<Variation.Experience> getLiveExperiences()
      All live experiences in variations instrumented on this state. An experience is live if the containing variation is online and instrumented on this state, and the session has been targeted for this experience.
      Returns:
      Set of Variation.Experience object. Cannot be null, but may be empty.
      Since:
      0.6
    • getLiveExperience

      Optional<Variation.Experience> getLiveExperience(Variation variation)
      The live experience in a given variation, if any. See getLiveExperiences() for definition of a live experience.
      Parameters:
      variation - Variation of interest.
      Returns:
      An Optional, containing the live experience in the given variation, or empty if none.
      Since:
      0.6
    • getStateVisitedEvent

      TraceEvent getStateVisitedEvent()
      Pending state visited event. State visited events are generated implicitly whenever a new state request is created, and are triggered automatically at the time the state request is committed with commit(Object...) or failed with fail(Object...). This method allows client code to enrich the pending state visited event with extra attributes that will be useful for the downstream analysis.
      Returns:
      Object of type TraceEvent. Cannot be null.
      Since:
      0.6
    • commit

      void commit(Object... userData)
      Complete this state request successfully. Causes the following to happen:

      No-op if this request has already been committed in this or a parallel session.

      Parameters:
      userData - An array of zero or more opaque objects which will be passed to the SessionIdTracker.save(Object...) method without interpretation.
      Since:
      0.6
    • fail

      void fail(Object... userData)
      Complete this state request unsuccessfully. Causes the following to happen:

      No-op if this request has already been committed in this or a parallel session.

      Parameters:
      userData - An array of zero or more opaque objects which will be passed to the SessionIdTracker.save(Object...) method without interpretation.
      Since:
      0.6