io.vertx.ext.consul

## Class KeyValue

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

- All Implemented Interfaces:
    TxnResult

      public class KeyValue
      extends Object
      implements TxnResult

  Represents key/value pair stored in Consul
  Author:
    Ruslan Sennov
  See Also:
    Consul key/value store

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyValue()` Default constructor
    `KeyValue(JsonObject json)` Constructor from JSON
    `KeyValue(KeyValue other)` Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `long` | `getCreateIndex()` Get the internal index value that represents when the entry was created.
    `long` | `getFlags()` Get the flags attached to this entry.
    `String` | `getKey()` Get the key
    `long` | `getLockIndex()` Get the number of times this key has successfully been acquired in a lock.
    `long` | `getModifyIndex()` Get the last index that modified this key.
    `TxnOperationType` | `getOperationType()`
    `String` | `getSession()` Get the session that owns the lock
    `String` | `getValue()` Get the value.
    `int` | `hashCode()`
    `boolean` | `isPresent()` Return `true` if there is a key/value pair present, otherwise `false`.
    `KeyValue` | `setCreateIndex(long createIndex)` Set the internal index value that represents when the entry was created.
    `KeyValue` | `setFlags(long flags)` Set the flags attached to this entry.
    `KeyValue` | `setKey(String key)` Set the key
    `KeyValue` | `setLockIndex(long lockIndex)` Set the number of times this key has successfully been acquired in a lock.
    `KeyValue` | `setModifyIndex(long modifyIndex)` Set the last index that modified this key.
    `KeyValue` | `setSession(String session)` Set the session that owns the lock
    `KeyValue` | `setValue(String value)` Set the value
    `JsonObject` | `toJson()` Convert to JSON

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

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

- - ### Constructor Detail

    - #### KeyValue

          public KeyValue()

      Default constructor

    - #### KeyValue

          public KeyValue(KeyValue other)

      Copy constructor
      Parameters:
        `other` - the one to copy

    - #### KeyValue

          public KeyValue(JsonObject json)

      Constructor from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        the JSON

    - #### isPresent

          public boolean isPresent()

      Return `true` if there is a key/value pair present, otherwise `false`.
      Returns:
        `true` if there is a key/value pair present, otherwise `false`

    - #### getKey

          public String getKey()

      Get the key
      Returns:
        the key

    - #### setKey

          public KeyValue setKey(String key)

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

    - #### getValue

          public String getValue()

      Get the value. In case if KeyValue is result of transaction, value can be empty
      Returns:
        the value

    - #### setValue

          public KeyValue setValue(String value)

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

    - #### getSession

          public String getSession()

      Get the session that owns the lock
      Returns:
        the session that owns the lock

    - #### setSession

          public KeyValue setSession(String session)

      Set the session that owns the lock
      Parameters:
        `session` - the session that owns the lock
      Returns:
        reference to this, for fluency

    - #### 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

    - #### setFlags

          public KeyValue 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

    - #### getCreateIndex

          public long getCreateIndex()

      Get the internal index value that represents when the entry was created.
      Returns:
        the internal index value that represents when the entry was created.

    - #### setCreateIndex

          public KeyValue setCreateIndex(long createIndex)

      Set the internal index value that represents when the entry was created.
      Parameters:
        `createIndex` - the internal index value that represents when the entry was created.
      Returns:
        reference to this, for fluency

    - #### getModifyIndex

          public long getModifyIndex()

      Get the last index that modified this key.
      Returns:
        the last index that modified this key.

    - #### setModifyIndex

          public KeyValue setModifyIndex(long modifyIndex)

      Set the last index that modified this key.
      Parameters:
        `modifyIndex` - the last index that modified this key.
      Returns:
        reference to this, for fluency

    - #### getLockIndex

          public long getLockIndex()

      Get the number of times this key has successfully been acquired in a lock.
      Returns:
        the number of times this key has successfully been acquired in a lock.

    - #### setLockIndex

          public KeyValue setLockIndex(long lockIndex)

      Set the number of times this key has successfully been acquired in a lock.
      Parameters:
        `lockIndex` - the number of times this key has successfully been acquired in a lock.
      Returns:
        reference to this, for fluency

    - #### getOperationType

          public TxnOperationType getOperationType()

      Specified by:
        `getOperationType` in interface `TxnResult`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2021 Eclipse. All rights reserved.