Package org.redisson.api
Interface RJsonBucket<V>
- Type Parameters:
V- the type of object
- All Superinterfaces:
RBucket<V>,RBucketAsync<V>,RExpirable,RExpirableAsync,RJsonBucketAsync<V>,RObject,RObjectAsync
- All Known Implementing Classes:
RedissonJsonBucket
Redis JSON datatype holder. Data is stored as JSON object in Redis
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionlongarrayAppend(String path, Object... values) Appends values to array specified by JSONPath.arrayAppendMulti(String path, Object... values) Appends values to arrays specified by JSONPath.longarrayIndex(String path, Object value) Returns index of object in array specified by JSONPathlongarrayIndex(String path, Object value, long start, long end) Returns index of object in array specified by JSONPath in range betweenstart(inclusive) andend(exclusive) indexesarrayIndexMulti(String path, Object value) Returns index of object in arrays specified by JSONPatharrayIndexMulti(String path, Object value, long start, long end) Returns index of object in arrays specified by JSONPath in range betweenstart(inclusive) andend(exclusive) indexeslongarrayInsert(String path, long index, Object... values) Inserts values into array specified by JSONPath.arrayInsertMulti(String path, long index, Object... values) Inserts values into arrays specified by JSONPath.<T> TarrayPollFirst(JsonCodec codec, String path) Polls first element of array specified by JSONPath.<T> List<T> arrayPollFirstMulti(JsonCodec codec, String path) Polls first element of arrays specified by JSONPath.<T> TarrayPollLast(JsonCodec codec, String path) Polls last element of array specified by JSONPath.<T> List<T> arrayPollLastMulti(JsonCodec codec, String path) Polls last element of arrays specified by JSONPath.<T> TPops element located at index of array specified by JSONPath.<T> List<T> arrayPopMulti(JsonCodec codec, String path, long index) Pops elements located at index of arrays specified by JSONPath.longReturns size of array specified by JSONPath.arraySizeMulti(String path) Returns size of arrays specified by JSONPath.longTrims array specified by JSONPath in range betweenstart(inclusive) andend(inclusive) indexes.arrayTrimMulti(String path, long start, long end) Trims arrays specified by JSONPath in range betweenstart(inclusive) andend(inclusive) indexes.longclear()Clears json container.longClears json container specified by JSONPath.booleancompareAndSet(String path, Object expect, Object update) Atomically sets the value to the given updated value by given JSONPath, only if serialized state of the current value equals to serialized state of the expected value.longReturns keys amount in JSON containerlongReturns keys amount in JSON container specified by JSONPathcountKeysMulti(String path) Returns list of keys amount in JSON containers specified by JSONPathlongDeletes JSON elements specified by JSONPath<T> TGet Json object/objects by JSONPath<T> TRetrieves current value of element specified by JSONPath and replaces it withnewValue.getKeys()Returns list of keys in JSON containerReturns list of keys in JSON container specified by JSONPathgetKeysMulti(String path) Returns list of keys in JSON containers specified by JSONPathgetType()Returns type of elementReturns type of element specified by JSONPath<T extends Number>
TincrementAndGet(String path, T delta) Increments the current value specified by JSONPath bydelta.incrementAndGetMulti(String path, T delta) Increments the current values specified by JSONPath bydelta.voidMerges object into element by the specified JSONPath.voidStores object into element by specified JSONPath.booleansetIfAbsent(String path, Object value) Sets Json object by JSONPath only if previous value is emptybooleansetIfExists(String path, Object value) Sets Json object by JSONPath only if previous value is non-emptylongstringAppend(String path, Object value) Appends string data to element specified by JSONPath.stringAppendMulti(String path, Object value) Appends string data to elements specified by JSONPath.stringSize(String path) Returns size of string data by JSONPathstringSizeMulti(String path) Returns list of string data size by JSONPath.booleanToggle boolean value specified by JSONPathtoggleMulti(String path) Toggle boolean values specified by JSONPathbooleanDeprecated.Methods inherited from interface org.redisson.api.RBucket
addListener, compareAndSet, findCommon, findCommonLength, get, getAndClearExpire, getAndDelete, getAndExpire, getAndExpire, getAndSet, getAndSet, getAndSet, set, set, set, setAndKeepTTL, setIfAbsent, setIfAbsent, setIfExists, setIfExists, setIfExists, size, trySet, trySetMethods inherited from interface org.redisson.api.RBucketAsync
addListenerAsync, compareAndSetAsync, findCommonAsync, findCommonLengthAsync, getAndClearExpireAsync, getAndDeleteAsync, getAndExpireAsync, getAndExpireAsync, getAndSetAsync, getAndSetAsync, getAndSetAsync, getAsync, setAndKeepTTLAsync, setAsync, setAsync, setAsync, setIfAbsentAsync, setIfAbsentAsync, setIfExistsAsync, setIfExistsAsync, setIfExistsAsync, sizeAsync, trySetAsync, trySetAsyncMethods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLiveMethods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsyncMethods inherited from interface org.redisson.api.RJsonBucketAsync
arrayAppendAsync, arrayAppendMultiAsync, arrayIndexAsync, arrayIndexAsync, arrayIndexMultiAsync, arrayIndexMultiAsync, arrayInsertAsync, arrayInsertMultiAsync, arrayPollFirstAsync, arrayPollFirstMultiAsync, arrayPollLastAsync, arrayPollLastMultiAsync, arrayPopAsync, arrayPopMultiAsync, arraySizeAsync, arraySizeMultiAsync, arrayTrimAsync, arrayTrimMultiAsync, clearAsync, clearAsync, compareAndSetAsync, countKeysAsync, countKeysAsync, countKeysMultiAsync, deleteAsync, getAndSetAsync, getAsync, getKeysAsync, getKeysAsync, getKeysMultiAsync, getTypeAsync, getTypeAsync, incrementAndGetAsync, incrementAndGetMultiAsync, mergeAsync, setAsync, setIfAbsentAsync, setIfExistsAsync, stringAppendAsync, stringAppendMultiAsync, stringSizeAsync, stringSizeMultiAsync, toggleAsync, toggleMultiAsync, trySetAsyncMethods inherited from interface org.redisson.api.RObject
copy, copy, copy, copyAndReplace, copyAndReplace, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkMethods inherited from interface org.redisson.api.RObjectAsync
copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
get
Get Json object/objects by JSONPath- Type Parameters:
T- the type of object- Parameters:
codec- object codecpaths- JSON paths- Returns:
- object
-
setIfAbsent
Sets Json object by JSONPath only if previous value is empty- Parameters:
path- JSON pathvalue- object- Returns:
trueif successful, orfalseif value was already set
-
trySet
Deprecated.UsesetIfAbsent(String, Object)instead- Parameters:
path- JSON pathvalue- object- Returns:
trueif successful, orfalseif value was already set
-
setIfExists
Sets Json object by JSONPath only if previous value is non-empty- Parameters:
path- JSON pathvalue- object- Returns:
trueif successful, orfalseif element wasn't set
-
compareAndSet
Atomically sets the value to the given updated value by given JSONPath, only if serialized state of the current value equals to serialized state of the expected value.- Parameters:
path- JSON pathexpect- the expected valueupdate- the new value- Returns:
trueif successful; orfalseif the actual value was not equal to the expected value.
-
getAndSet
Retrieves current value of element specified by JSONPath and replaces it withnewValue.- Parameters:
codec- object codecpath- JSON pathnewValue- value to set- Returns:
- previous value
-
set
Stores object into element by specified JSONPath.- Parameters:
path- JSON pathvalue- value to set
-
stringSize
Returns size of string data by JSONPath- Parameters:
path- JSON path- Returns:
- size of string
-
stringSizeMulti
Returns list of string data size by JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON path- Returns:
- list of string data sizes
-
stringAppend
Appends string data to element specified by JSONPath. Returns new size of string data.- Parameters:
path- JSON pathvalue- data- Returns:
- size of string data
-
stringAppendMulti
Appends string data to elements specified by JSONPath. Returns new size of string data. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathvalue- data- Returns:
- list of string data sizes
-
arrayAppend
Appends values to array specified by JSONPath. Returns new size of array.- Parameters:
path- JSON pathvalues- values to append- Returns:
- size of array
-
arrayAppendMulti
Appends values to arrays specified by JSONPath. Returns new size of arrays. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathvalues- values to append- Returns:
- list of arrays size
-
arrayIndex
Returns index of object in array specified by JSONPath. -1 means object not found.- Parameters:
path- JSON pathvalue- value to search- Returns:
- index in array
-
arrayIndexMulti
Returns index of object in arrays specified by JSONPath. -1 means object not found. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathvalue- value to search- Returns:
- list of index in arrays
-
arrayIndex
Returns index of object in array specified by JSONPath in range betweenstart(inclusive) andend(exclusive) indexes. -1 means object not found.- Parameters:
path- JSON pathvalue- value to searchstart- start index, inclusiveend- end index, exclusive- Returns:
- index in array
-
arrayIndexMulti
Returns index of object in arrays specified by JSONPath in range betweenstart(inclusive) andend(exclusive) indexes. -1 means object not found. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathvalue- value to searchstart- start index, inclusiveend- end index, exclusive- Returns:
- list of index in arrays
-
arrayInsert
Inserts values into array specified by JSONPath. Values are inserted at definedindex.- Parameters:
path- JSON pathindex- array index at which values are insertedvalues- values to insert- Returns:
- size of array
-
arrayInsertMulti
Inserts values into arrays specified by JSONPath. Values are inserted at definedindex. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathindex- array index at which values are insertedvalues- values to insert- Returns:
- list of arrays size
-
arraySize
Returns size of array specified by JSONPath.- Parameters:
path- JSON path- Returns:
- size of array
-
arraySizeMulti
Returns size of arrays specified by JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON path- Returns:
- list of arrays size
-
arrayPollLast
Polls last element of array specified by JSONPath.- Type Parameters:
T- the type of object- Parameters:
codec- object codecpath- JSON path- Returns:
- last element
-
arrayPollLastMulti
Polls last element of arrays specified by JSONPath. Compatible only with enhanced syntax starting with '$' character.- Type Parameters:
T- the type of object- Parameters:
codec- object codecpath- JSON path- Returns:
- list of last elements
-
arrayPollFirst
Polls first element of array specified by JSONPath.- Type Parameters:
T- the type of object- Parameters:
codec- object codecpath- JSON path- Returns:
- first element
-
arrayPollFirstMulti
Polls first element of arrays specified by JSONPath. Compatible only with enhanced syntax starting with '$' character.- Type Parameters:
T- the type of object- Parameters:
codec- object codecpath- JSON path- Returns:
- list of first elements
-
arrayPop
Pops element located at index of array specified by JSONPath.- Type Parameters:
T- the type of object- Parameters:
codec- object codecpath- JSON pathindex- array index- Returns:
- element
-
arrayPopMulti
Pops elements located at index of arrays specified by JSONPath. Compatible only with enhanced syntax starting with '$' character.- Type Parameters:
T- the type of object- Parameters:
codec- object codecpath- JSON pathindex- array index- Returns:
- list of elements
-
arrayTrim
Trims array specified by JSONPath in range betweenstart(inclusive) andend(inclusive) indexes.- Parameters:
path- JSON pathstart- start index, inclusiveend- end index, inclusive- Returns:
- length of array
-
arrayTrimMulti
Trims arrays specified by JSONPath in range betweenstart(inclusive) andend(inclusive) indexes. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathstart- start index, inclusiveend- end index, inclusive- Returns:
- length of array
-
clear
long clear()Clears json container.- Returns:
- number of cleared containers
-
clear
Clears json container specified by JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON path- Returns:
- number of cleared containers
-
incrementAndGet
Increments the current value specified by JSONPath bydelta.- Parameters:
path- JSON pathdelta- increment value- Returns:
- the updated value
-
incrementAndGetMulti
Increments the current values specified by JSONPath bydelta. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathdelta- increment value- Returns:
- list of updated value
-
merge
Merges object into element by the specified JSONPath.- Parameters:
path- JSON pathvalue- value to merge
-
countKeys
long countKeys()Returns keys amount in JSON container- Returns:
- keys amount
-
countKeys
Returns keys amount in JSON container specified by JSONPath- Parameters:
path- JSON path- Returns:
- keys amount
-
countKeysMulti
Returns list of keys amount in JSON containers specified by JSONPath- Parameters:
path- JSON path- Returns:
- list of keys amount
-
getKeys
Returns list of keys in JSON container- Returns:
- list of keys
-
getKeys
Returns list of keys in JSON container specified by JSONPath- Parameters:
path- JSON path- Returns:
- list of keys
-
getKeysMulti
Returns list of keys in JSON containers specified by JSONPath- Parameters:
path- JSON path- Returns:
- list of keys
-
toggle
Toggle boolean value specified by JSONPath- Parameters:
path- JSON path- Returns:
- new boolean value
-
toggleMulti
Toggle boolean values specified by JSONPath- Parameters:
path- JSON path- Returns:
- list of boolean values
-
getType
JsonType getType()Returns type of element- Returns:
- type of element
-
getType
Returns type of element specified by JSONPath- Parameters:
path- JSON path- Returns:
- type of element
-
delete
Deletes JSON elements specified by JSONPath- Parameters:
path- JSON path- Returns:
- number of deleted elements
-