Class MutationState

java.lang.Object
com.couchbase.client.java.kv.MutationState
All Implemented Interfaces:
Iterable<com.couchbase.client.core.msg.kv.MutationToken>

public class MutationState extends Object implements Iterable<com.couchbase.client.core.msg.kv.MutationToken>
Aggregation of one or more MutationTokens for specifying consistency requirements of N1QL or FTS queries.

Thread-safe.

Since:
2.3.0
  • Method Details

    • from

      public static MutationState from(com.couchbase.client.core.msg.kv.MutationToken... mutationTokens)
      Create a MutationState from one or more MutationTokens.
      Parameters:
      mutationTokens - the mutation tokens.
      Returns:
      the initialized MutationState.
    • add

      public MutationState add(com.couchbase.client.core.msg.kv.MutationToken... mutationTokens)
      Add one or more MutationTokens to this MutationState.
      Parameters:
      mutationTokens - the tokens
      Returns:
      the modified MutationState.
    • add

      public MutationState add(MutationState mutationState)
      Adds all the internal state from the given MutationState onto the called one.
      Parameters:
      mutationState - the state from which the tokens are applied from.
      Returns:
      the modified MutationState.
    • iterator

      public Iterator<com.couchbase.client.core.msg.kv.MutationToken> iterator()
      Specified by:
      iterator in interface Iterable<com.couchbase.client.core.msg.kv.MutationToken>
    • export

      public JsonObject export()
      Exports the MutationState into a universal format, which can be used either to serialize it into a N1QL query or to send it over the network to a different application/SDK.
      Returns:
      the exported JsonObject.
    • exportForSearch

      public JsonObject exportForSearch()
      Exports the MutationState into a format recognized by the FTS search engine.
      Returns:
      the exported JsonObject for one FTS index.
    • from

      public static MutationState from(String source)
      Create a MutationState from the serialized state.
      Parameters:
      source - the source state, serialized.
      Returns:
      the created MutationState.
    • from

      public static MutationState from(JsonObject source)
      Create a MutationState from the serialized state.
      Parameters:
      source - the source state, serialized.
      Returns:
      the created MutationState.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object