public class KvResource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected OrchestrateClient |
client
The Orchestrate client to make requests with.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper
The object mapper used to deserialize JSON responses.
|
| Modifier and Type | Method and Description |
|---|---|
OrchestrateRequest<java.lang.Boolean> |
delete()
|
OrchestrateRequest<java.lang.Boolean> |
delete(boolean purge)
Purge a KV object from a collection in the Orchestrate.io service.
|
<T> OrchestrateRequest<KvObject<T>> |
get(java.lang.Class<T> clazz)
|
<T> OrchestrateRequest<KvObject<T>> |
get(java.lang.Class<T> clazz,
java.lang.String ref)
Fetch an object by key from the Orchestrate service.
|
KvResource |
ifAbsent()
Equivalent to
this.ifAbsent(Boolean.TRUE). |
KvResource |
ifAbsent(boolean ifAbsent)
Whether to store the object if no key already exists.
|
KvResource |
ifMatch(java.lang.String objectRef)
The last known version of the stored object to match for the request to
succeed.
|
OrchestrateRequest<KvMetadata> |
put(java.lang.Object value)
Store an object by key to the Orchestrate service.
|
protected final OrchestrateClient client
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
public OrchestrateRequest<java.lang.Boolean> delete()
public OrchestrateRequest<java.lang.Boolean> delete(boolean purge)
Usage:
boolean result =
client.kv("someCollection", "someKey")
.delete(Boolean.TRUE)
.get();
purge - If true, permanently delete the object AND its "ref"
history from Orchestrate.public <T> OrchestrateRequest<KvObject<T>> get(java.lang.Class<T> clazz)
public <T> OrchestrateRequest<KvObject<T>> get(@NonNull java.lang.Class<T> clazz, @Nullable java.lang.String ref)
Usage:
KvObject<DomainObject> object =
client.kv("someCollection", "someKey")
.get(DomainObject.class)
.get();
T - The type to deserialize the result to.clazz - Type information for marshalling objects at runtime.ref - The version of the object to get.public KvResource ifAbsent()
this.ifAbsent(Boolean.TRUE).ifAbsent(boolean)public KvResource ifAbsent(boolean ifAbsent)
ifAbsent - If truepublic KvResource ifMatch(@NonNull java.lang.String objectRef)
objectRef - The last known version of the stored object.public OrchestrateRequest<KvMetadata> put(@NonNull java.lang.Object value)
Usage:
DomainObject obj = new DomainObject();
KvMetadata kvMetadata =
client.kv("someCollection", "someKey")
.put(obj)
.get();
value - The object to store.