Class KeyValNameSpace
java.lang.Object
com.tccc.kos.commons.core.service.keyval.KeyValNameSpace
Wrapper around
KeyValService
that binds all accesses to a particular namespace.- Version:
- 2023-09-06
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return true if the specified key exists.Get the value of the specified key.<T> T
Get the value of the specified key and convert the string to an instance of the specified type.getAll()
Return all key/val pairs in this name space.Return all key/val pairs in this name space as instance of the specified class.Return all keys in this name space.byte[]
Get the value of the specified key as a blob.Return the name space name.void
Remove the specified key/val.void
Remove all the key/vals in this name space.void
Set the value of the specified key.void
Set the value of the specified key with optional encryption.void
Set the value of the specified key to the specified blob.void
Set the value of the specified key to the specified blob with optional encryption.void
Set the value of the specified key to the json of the specified value object.void
Set the value of the specified key to the json of the specified value object with optional encryption.
-
Constructor Details
-
KeyValNameSpace
-
-
Method Details
-
set
Set the value of the specified key with optional encryption.- Parameters:
name
- the key nameval
- the valueencrypted
- if true, encrypt the value
-
set
Set the value of the specified key.- Parameters:
name
- the key nameval
- the value
-
setObj
Set the value of the specified key to the json of the specified value object.- Parameters:
name
- the key nameval
- the object to convert to json and store
-
setObj
Set the value of the specified key to the json of the specified value object with optional encryption.- Parameters:
name
- the key nameval
- the object to convert to json and storeencrypted
- if true, encrypt value in the database
-
setBlob
Set the value of the specified key to the specified blob.- Parameters:
name
- the key nameval
- the array of bytes to store
-
setBlob
Set the value of the specified key to the specified blob with optional encryption.- Parameters:
name
- the key nameval
- the object to convert to json and storeencrypted
- if true, encrypt the data in storage
-
exists
Return true if the specified key exists.- Parameters:
name
- the key name
-
get
Get the value of the specified key. If the value is encrypted it will automatically be decrypted.- Parameters:
name
- the key name
-
get
Get the value of the specified key and convert the string to an instance of the specified type. If the value is encrypted it will automatically be decrypted.- Parameters:
name
- the key nameclazz
- the type to convert the value to- Throws:
Exception
-
getBlob
Get the value of the specified key as a blob. This is only valid for fetching values that were stored usingsetBlob()
.- Parameters:
name
- the key name- Throws:
Exception
-
remove
Remove the specified key/val.- Parameters:
name
- the key name
-
getAllKeys
Return all keys in this name space. -
getAll
Return all key/val pairs in this name space. -
getAll
Return all key/val pairs in this name space as instance of the specified class. -
removeAll
public void removeAll()Remove all the key/vals in this name space. -
getNameSpace
Return the name space name.
-