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.BucketPropertyPathleading to the currentBucket.getPropertyPath(String property) Get theBucket.BucketPropertyPathfor a given property within the currentBucket.booleanReturn whetherpathis associated with a non-nullvalue.booleanisEmpty()keySet()static BucketnewBucketFromRawMap(Map<byte[], byte[]> source) Creates a new Bucket from a given raw map.static BucketnewBucketFromStringMap(Map<String, String> source) Creates a new Bucket from a givenStringmap.voidAddStringrepresentation of property dot path with given value.Map<byte[],byte[]> rawMap()Get keys and values in binary format.voidRemove the property at property dotpath.intsize()toString()Collection<byte[]>values()
-
Field Details
-
CHARSET
-
-
Constructor Details
-
Bucket
public Bucket()Creates a new empty bucket.
-
-
Method Details
-
put
AddStringrepresentation 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 whetherpathis associated with a non-nullvalue.- Parameters:
path- must not be null orString.isEmpty().- Returns:
- true if the
pathis associated with a non-nullvalue. - 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 or empty.
-
rawMap
Get keys and values in binary format.- Returns:
- never null.
-
getPath
Get theBucket.BucketPropertyPathleading to the currentBucket.- Returns:
- new instance of
Bucket.BucketPropertyPath. - Since:
- 2.1
-
getPropertyPath
Get theBucket.BucketPropertyPathfor 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 givenStringmap.- Parameters:
source- can be null.- Returns:
- never null.
-
toString
-