io.vertx.ext.consul

## Class KeyValueOptions

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

-     public class KeyValueOptions
      extends Object

  Options used to put key/value pair to Consul.
  Author:
    Ruslan Sennov

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyValueOptions()` Default constructor
    `KeyValueOptions(JsonObject options)` Constructor from JSON
    `KeyValueOptions(KeyValueOptions options)` Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAcquireSession()` Get session ID for lock acquisition operation.
    `long` | `getCasIndex()` Get the Check-And-Set index.
    `long` | `getFlags()` Get the flags.
    `String` | `getReleaseSession()` Get session ID for lock release operation.
    `KeyValueOptions` | `setAcquireSession(String acquireSession)` Set session ID for lock acquisition operation.
    `KeyValueOptions` | `setCasIndex(long index)` Set the Check-And-Set index.
    `KeyValueOptions` | `setFlags(long flags)` Set the flags.
    `KeyValueOptions` | `setReleaseSession(String releaseSession)` Set session ID for lock release operation.
    `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

    - #### KeyValueOptions

          public KeyValueOptions()

      Default constructor

    - #### KeyValueOptions

          public KeyValueOptions(KeyValueOptions options)

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

    - #### KeyValueOptions

          public KeyValueOptions(JsonObject options)

      Constructor from JSON
      Parameters:
        `options` - the JSON

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        the JSON

    - #### getAcquireSession

          public String getAcquireSession()

      Get session ID for lock acquisition operation.
      Returns:
        the ID of session

    - #### setAcquireSession

          public KeyValueOptions setAcquireSession(String acquireSession)

      Set session ID for lock acquisition operation.
      Parameters:
        `acquireSession` - the ID of session
      Returns:
        reference to this, for fluency

    - #### getReleaseSession

          public String getReleaseSession()

      Get session ID for lock release operation.
      Returns:
        the ID of session

    - #### setReleaseSession

          public KeyValueOptions setReleaseSession(String releaseSession)

      Set session ID for lock release operation.
      Parameters:
        `releaseSession` - the ID of session
      Returns:
        reference to this, for fluency

    - #### getFlags

          public long getFlags()

      Get the flags. Flags is an value between `0` and 264-1 that can be attached to each entry. Clients can choose to use this however makes sense for their application.
      Returns:
        the flags

    - #### setFlags

          public KeyValueOptions setFlags(long flags)

      Set the flags. Flags is an value between `0` and 264-1 that can be attached to each entry. Clients can choose to use this however makes sense for their application.
      Parameters:
        `flags` - the flags
      Returns:
        reference to this, for fluency

    - #### getCasIndex

          public long getCasIndex()

      Get the Check-And-Set index. If the index is `0`, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
      Returns:
        the Check-And-Set index
      See Also:
        `KeyValue.getModifyIndex()`

    - #### setCasIndex

          public KeyValueOptions setCasIndex(long index)

      Set the Check-And-Set index. If the index is `0`, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
      Parameters:
        `index` - the Check-And-Set index
      Returns:
        reference to this, for fluency
      See Also:
        `KeyValue.getModifyIndex()`

Copyright © 2025 Eclipse. All rights reserved.