Package io.vertx.ext.consul

## Class TxnKVOperation

- java.lang.Object
- - io.vertx.ext.consul.TxnKVOperation

- All Implemented Interfaces:
    `TxnOperation`

      public class TxnKVOperation
      extends Object
      implements TxnOperation

  Holds operation to apply to the key/value store inside a transaction
  Author:
    Ruslan Sennov

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TxnKVOperation()` | Default constructor
    `TxnKVOperation​(JsonObject json)` | Constructor from JSON

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `getFlags()` | Get the flags attached to this entry.
    `long` | `getIndex()` | Get the index used for locking, unlocking, and check-and-set operations.
    `String` | `getKey()` | Get the key
    `TxnOperationType` | `getOperationType()` | Returns the type of operation in a transaction
    `String` | `getSession()` | Get the session used for locking, unlocking, and check-and-set operations.
    `TxnKVVerb` | `getType()` | Get the type of operation to perform
    `String` | `getValue()` | Get the value
    `TxnKVOperation` | `setFlags​(long flags)` | Set the flags attached to this entry.
    `TxnKVOperation` | `setIndex​(long index)` | Set the index used for locking, unlocking, and check-and-set operations.
    `TxnKVOperation` | `setKey​(String key)` | Set the key
    `TxnKVOperation` | `setSession​(String session)` | Set the session used for locking, unlocking, and check-and-set operations.
    `TxnKVOperation` | `setType​(TxnKVVerb type)` | Set the type of operation to perform
    `TxnKVOperation` | `setValue​(String value)` | Set the value
    `JsonObject` | `toJson()` | Convert to JSON

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TxnKVOperation

          public TxnKVOperation()

      Default constructor

    - #### TxnKVOperation

          public TxnKVOperation​(JsonObject json)

      Constructor from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        the JSON

    - #### getType

          public TxnKVVerb getType()

      Get the type of operation to perform
      Returns:
        the type of operation to perform

    - #### getKey

          public String getKey()

      Get the key
      Returns:
        the key

    - #### getValue

          public String getValue()

      Get the value
      Returns:
        the value

    - #### getFlags

          public long getFlags()

      Get the flags attached to this entry. Clients can choose to use this however makes sense for their application.
      Returns:
        the flags attached to this entry

    - #### getIndex

          public long getIndex()

      Get the index used for locking, unlocking, and check-and-set operations.
      Returns:
        the index
      See Also:
        /v1/txn endpoint

    - #### getSession

          public String getSession()

      Get the session used for locking, unlocking, and check-and-set operations.
      Returns:
        the session
      See Also:
        /v1/txn endpoint

    - #### setType

          public TxnKVOperation setType​(TxnKVVerb type)

      Set the type of operation to perform
      Parameters:
        `type` - the type of operation to perform
      Returns:
        reference to this, for fluency

    - #### setKey

          public TxnKVOperation setKey​(String key)

      Set the key
      Parameters:
        `key` - the key
      Returns:
        reference to this, for fluency

    - #### setValue

          public TxnKVOperation setValue​(String value)

      Set the value
      Parameters:
        `value` - the value
      Returns:
        reference to this, for fluency

    - #### setFlags

          public TxnKVOperation setFlags​(long flags)

      Set the flags attached to this entry. Clients can choose to use this however makes sense for their application.
      Parameters:
        `flags` - the flags attached to this entry. Clients can choose to use this however makes sense for their application.
      Returns:
        reference to this, for fluency

    - #### setIndex

          public TxnKVOperation setIndex​(long index)

      Set the index used for locking, unlocking, and check-and-set operations.
      Parameters:
        `index` - the index
      Returns:
        reference to this, for fluency
      See Also:
        /v1/txn endpoint

    - #### setSession

          public TxnKVOperation setSession​(String session)

      Set the session used for locking, unlocking, and check-and-set operations.
      Parameters:
        `session` - the session
      Returns:
        reference to this, for fluency
      See Also:
        /v1/txn endpoint

    - #### getOperationType

          public TxnOperationType getOperationType()

      Description copied from interface: `TxnOperation`
      Returns the type of operation in a transaction
      Specified by:
        `getOperationType` in interface `TxnOperation`
      Returns:
        the type of operation in a transaction