Class KeyValue
java.lang.Object
io.vertx.ext.consul.KeyValue
- All Implemented Interfaces:
TxnResult
Represents key/value pair stored in Consul
- Author:
- Ruslan Sennov
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKeyValue()Default constructorKeyValue(JsonObject json) Constructor from JSONCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongGet the internal index value that represents when the entry was created.longgetFlags()Get the flags attached to this entry.getKey()Get the keylongGet the number of times this key has successfully been acquired in a lock.longGet the last index that modified this key.Get the session that owns the lockgetValue()Get the value.inthashCode()booleanReturntrueif there is a key/value pair present, otherwisefalse.setCreateIndex(long createIndex) Set the internal index value that represents when the entry was created.setFlags(long flags) Set the flags attached to this entry.Set the keysetLockIndex(long lockIndex) Set the number of times this key has successfully been acquired in a lock.setModifyIndex(long modifyIndex) Set the last index that modified this key.setSession(String session) Set the session that owns the lockSet the valuetoJson()Convert to JSON
-
Constructor Details
-
KeyValue
public KeyValue()Default constructor -
KeyValue
-
KeyValue
-
-
Method Details
-
toJson
-
isPresent
public boolean isPresent()Returntrueif there is a key/value pair present, otherwisefalse.- Returns:
trueif there is a key/value pair present, otherwisefalse
-
getKey
-
setKey
-
getValue
Get the value. In case if KeyValue is result of transaction, value can be empty- Returns:
- the value
-
setValue
-
getSession
Get the session that owns the lock- Returns:
- the session that owns the lock
-
setSession
-
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
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
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
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
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
- Specified by:
getOperationTypein interfaceTxnResult
-
equals
-
hashCode
-