Package io.rocketbase.commons.model
Interface HasKeyValue
-
- All Known Subinterfaces:
EntityWithKeyValue<T>
public interface HasKeyValueentity/dto has key value capability
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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-stringMap<String,String>getKeyValues()default booleanhasKeyValue(String key)checks if user has keyvoidsetKeyValues(Map<String,String> keyValues)
-
-
-
Method Detail
-
getKeyValues
@Nullable Map<String,String> getKeyValues()
- Returns:
- the internal map - changes should only be done by add/remove KeyValue
-
hasKeyValue
default boolean hasKeyValue(String key)
checks if user has key- Parameters:
key- name of key- Returns:
- true when exists
-
getKeyValue
default String getKeyValue(String key)
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
default Boolean getKeyValueBoolean(String key, Boolean fallback)
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
default Long getKeyValueLong(String key, Long fallback)
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
default Collection<String> getKeyValueCollection(String key, Collection<String> fallback)
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
-
-