Package io.rocketbase.commons.model
Interface HasKeyValue
- All Known Subinterfaces:
EntityWithKeyValue<T>
public interface HasKeyValue
entity/dto has key value capability
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetKeyValue(String key) search for value of given keydefault <T> TgetKeyValue(String key, com.fasterxml.jackson.core.type.TypeReference<T> reference, T fallback) search for value of given key and parse json-stringdefault BooleangetKeyValueBoolean(String key, Boolean fallback) search for value of given key and parse json-stringdefault Collection<String>getKeyValueCollection(String key, Collection<String> fallback) search for value of given key and parse json-stringdefault LonggetKeyValueLong(String key, Long fallback) search for value of given key and parse json-stringdefault booleanhasKeyValue(String key) checks if user has keyvoidsetKeyValues(Map<String, String> keyValues)
-
Method Details
-
getKeyValues
- Returns:
- the internal map - changes should only be done by add/remove KeyValue
-
setKeyValues
-
hasKeyValue
checks if user has key- Parameters:
key- name of key- Returns:
- true when exists
-
getKeyValue
search for value of given key- Parameters:
key- name of key- Returns:
- value or null when not found
-
getKeyValue
default <T> T getKeyValue(String key, com.fasterxml.jackson.core.type.TypeReference<T> reference, T fallback) search for value of given key and parse json-string- Parameters:
key- name of keyreference- used by objectMapperfallback- when key not found or not readable- Returns:
- value or fallback
-
getKeyValueBoolean
search for value of given key and parse json-string- Parameters:
key- name of keyfallback- when key not found or not readable- Returns:
- value or fallback
-
getKeyValueLong
search for value of given key and parse json-string- Parameters:
key- name of keyfallback- when key not found or not readable- Returns:
- value or fallback
-
getKeyValueCollection
search for value of given key and parse json-string- Parameters:
key- name of keyfallback- when key not found or not readable- Returns:
- value or fallback
-