public class KvResource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected OrchestrateClient |
client
The Orchestrate client to make requests with.
|
protected JacksonMapper |
jacksonMapper |
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> |
merge(java.lang.String jsonObject) |
OrchestrateRequest<KvMetadata> |
patch(JsonPatch patchOps) |
OrchestrateRequest<KvMetadata> |
put(java.lang.Object value)
Store an object by key to the Orchestrate service.
|
protected byte[] |
toJsonBytes(java.lang.Object value) |
protected com.fasterxml.jackson.databind.JsonNode |
toJsonNode(org.glassfish.grizzly.http.HttpContent response) |
protected <T> KvObject<T> |
toKvObject(org.glassfish.grizzly.http.HttpContent response,
java.lang.String collection,
java.lang.String key,
java.lang.Class<T> clazz) |
protected <T> KvObject<T> |
toKvObject(com.fasterxml.jackson.databind.JsonNode result,
java.lang.Class<T> clazz) |
protected final OrchestrateClient client
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
protected final JacksonMapper jacksonMapper
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.public OrchestrateRequest<KvMetadata> patch(JsonPatch patchOps)
public OrchestrateRequest<KvMetadata> merge(java.lang.String jsonObject)
protected byte[] toJsonBytes(java.lang.Object value)
protected com.fasterxml.jackson.databind.JsonNode toJsonNode(org.glassfish.grizzly.http.HttpContent response)
throws java.io.IOException
java.io.IOExceptionprotected <T> KvObject<T> toKvObject(com.fasterxml.jackson.databind.JsonNode result, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOExceptionprotected <T> KvObject<T> toKvObject(org.glassfish.grizzly.http.HttpContent response, java.lang.String collection, java.lang.String key, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOException