Package knf.hydra.core.tools
Object ModulePreferences
-
- All Implemented Interfaces:
public class ModulePreferencesObject used to access the module preferences defined in HeadConfig.settingsPage
-
-
Field Summary
Fields Modifier and Type Field Description public final static ModulePreferencesINSTANCE
-
Method Summary
Modifier and Type Method Description final <T extends Any> TgetPreference(String key, T default)Get preference value by key or default suspending coroutine final <T extends Any> TgetPreferenceOrNull(String key)Get preference value by key or null suspending coroutine final <T extends Any> TgetPreferenceOrThrow(String key)Get preference value by key or throw suspending coroutine final <T extends Any> UnitsetPreference(String key, T value)Set preference value by key suspending coroutine final <T extends Any> TgetPreferenceBlocking(String key, T default)Get preference value by key or default blocking the thread final <T extends Any> TgetPreferenceOrNullBlocking(String key)Get preference value by key or null blocking the thread final <T extends Any> TgetPreferenceOrThrowBlocking(String key)Get preference value by key or throw blocking the thread final <T extends Any> UnitsetPreferenceBlocking(String key, T value)Set preference value by key blocking the thread -
-
Method Detail
-
getPreference
final <T extends Any> T getPreference(String key, T default)
- Parameters:
key- Preference keydefault- Default value- Returns:
The value of the preference or default if not found or is null
-
getPreferenceOrNull
final <T extends Any> T getPreferenceOrNull(String key)
Get preference value by key or null suspending coroutine
- Parameters:
key- Preference key- Returns:
The value of the preference or null if not found
-
getPreferenceOrThrow
final <T extends Any> T getPreferenceOrThrow(String key)
Get preference value by key or throw suspending coroutine
- Parameters:
key- Preference key- Returns:
The value of the preference or throw if not found
-
setPreference
final <T extends Any> Unit setPreference(String key, T value)
Set preference value by key suspending coroutine
- Parameters:
key- Preference keyvalue- The value of the preference
-
getPreferenceBlocking
final <T extends Any> T getPreferenceBlocking(String key, T default)
- Parameters:
key- Preference keydefault- Default value- Returns:
The value of the preference or default if not found or is null
-
getPreferenceOrNullBlocking
final <T extends Any> T getPreferenceOrNullBlocking(String key)
Get preference value by key or null blocking the thread
- Parameters:
key- Preference key- Returns:
The value of the preference or null if not found
-
getPreferenceOrThrowBlocking
final <T extends Any> T getPreferenceOrThrowBlocking(String key)
Get preference value by key or throw blocking the thread
- Parameters:
key- Preference key- Returns:
The value of the preference or throw if not found
-
-
-
-