-
public class ConfigManagerCreated by adeshmukh on 10/02/25. Project Name: OSMOS-Android-SDK File Name: ConfigManager
-
-
Field Summary
Fields Modifier and Type Field Description private final Configconfigpublic final static ConfigManagerINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitloadConfig(Context context, Integer resourceId)Loads configuration from a raw resource file. final UnitloadConfigFromString(String jsonString)Loads configuration directly from a JSON string. final UnitloadConfigFromMap(Map<String, Object> configMap)Loads configuration from a map (commonly passed from native or testing layers). final UnitloadConfigFromData(Context context, Config config)final BooleanisConfigLoaded()Checks whether the config is loaded and available. final BooleanisDebugEnabled()Returns the debug mode flag. final ConfiggetStructuredConfig()Returns the strongly typed structured configuration. final StringgetString(String key)Retrieves a string value from the JSON config. final ConfiggetConfig()-
-
Method Detail
-
loadConfig
final Unit loadConfig(Context context, Integer resourceId)
Loads configuration from a raw resource file. Thread-safe method that prevents race conditions during initialization.
- Parameters:
context-Application context.
resourceId-Resource ID of the config JSON file (e.g., R.raw.osmos_config).
-
loadConfigFromString
final Unit loadConfigFromString(String jsonString)
Loads configuration directly from a JSON string. Thread-safe method that prevents race conditions during initialization.
- Parameters:
jsonString-JSON-formatted configuration string.
-
loadConfigFromMap
final Unit loadConfigFromMap(Map<String, Object> configMap)
Loads configuration from a map (commonly passed from native or testing layers). Thread-safe method that prevents race conditions during initialization.
- Parameters:
configMap-Configuration map.
-
loadConfigFromData
final Unit loadConfigFromData(Context context, Config config)
-
isConfigLoaded
final Boolean isConfigLoaded()
Checks whether the config is loaded and available. Thread-safe method using volatile field access.
-
isDebugEnabled
final Boolean isDebugEnabled()
Returns the debug mode flag. Thread-safe method using volatile field access.
-
getStructuredConfig
final Config getStructuredConfig()
Returns the strongly typed structured configuration. Thread-safe method that throws exception if config not loaded.
-
getString
final String getString(String key)
Retrieves a string value from the JSON config. Thread-safe method with synchronized access to configData.
- Parameters:
key-The key to retrieve
-
-
-
-