Class Bucket
java.lang.Object
org.springframework.data.redis.core.convert.Bucket
Bucket is the data bag for Redis hash structures to be used with
RedisData
.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch, Stefan Berger
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMap()
Key/value pairs contained in theBucket
.entrySet()
A set view of the mappings contained in this bucket.Extracts a bucket containing key/value pairs with theprefix
.extractAllKeysFor
(String path) Get all the keys matching a given path.byte[]
Get value assigned with path.getPath()
Get theBucket.BucketPropertyPath
leading to the currentBucket
.getPropertyPath
(String property) Get theBucket.BucketPropertyPath
for a given property within the currentBucket
.boolean
Return whetherpath
is associated with a non-null value.boolean
isEmpty()
keySet()
static Bucket
newBucketFromRawMap
(Map<byte[], byte[]> source) Creates a new Bucket from a given raw map.static Bucket
newBucketFromStringMap
(Map<String, String> source) Creates a new Bucket from a givenString
map.void
AddString
representation of property dot path with given value.Map<byte[],
byte[]> rawMap()
Get keys and values in binary format.void
Remove the property at property dotpath
.int
size()
toString()
Collection<byte[]>
values()
-
Field Details
-
CHARSET
-
-
Constructor Details
-
Bucket
public Bucket()Creates a new empty bucket.
-
-
Method Details
-
put
AddString
representation of property dot path with given value.- Parameters:
path
- must not be null orString.isEmpty()
.value
- can be null.
-
remove
Remove the property at property dotpath
.- Parameters:
path
- must not be null orString.isEmpty()
.
-
get
Get value assigned with path.- Parameters:
path
- must not be null orString.isEmpty()
.- Returns:
- null if not set.
-
hasValue
Return whetherpath
is associated with a non-null value.- Parameters:
path
- must not be null orString.isEmpty()
.- Returns:
- true if the
path
is associated with a non-null value. - Since:
- 2.5
-
entrySet
A set view of the mappings contained in this bucket.- Returns:
- never null.
-
isEmpty
public boolean isEmpty()- Returns:
- true when no data present in
Bucket
.
-
size
public int size()- Returns:
- the number of key-value mappings of the
Bucket
.
-
values
- Returns:
- never null.
-
keySet
- Returns:
- never null.
-
asMap
Key/value pairs contained in theBucket
.- Returns:
- never null.
-
extract
Extracts a bucket containing key/value pairs with theprefix
.- Parameters:
prefix
-- Returns:
-
extractAllKeysFor
Get all the keys matching a given path.- Parameters:
path
- the path to look for. Can be null.- Returns:
- all keys if path is null or empty.
-
rawMap
Get keys and values in binary format.- Returns:
- never null.
-
getPath
Get theBucket.BucketPropertyPath
leading to the currentBucket
.- Returns:
- new instance of
Bucket.BucketPropertyPath
. - Since:
- 2.1
-
getPropertyPath
Get theBucket.BucketPropertyPath
for a given property within the currentBucket
.- Parameters:
property
- the property to look up.- Returns:
- new instance of
Bucket.BucketPropertyPath
. - Since:
- 2.1
-
newBucketFromRawMap
Creates a new Bucket from a given raw map.- Parameters:
source
- can be null.- Returns:
- never null.
-
newBucketFromStringMap
Creates a new Bucket from a givenString
map.- Parameters:
source
- can be null.- Returns:
- never null.
-
toString
-