Class TypeSafeConfig
java.lang.Object
com.wualabs.qtsurfer.common.config.TypeSafeConfig
Base TypeSafe's Config wrapper class
-
Constructor Summary
ConstructorsConstructorDescriptionTypeSafeConfig(@NonNull com.typesafe.config.Config config) TypeSafeConfig(@NonNull com.typesafe.config.Config config, String name) TypeSafeConfig(@NonNull com.typesafe.config.Config config, String name, boolean envOverrides) -
Method Summary
Modifier and TypeMethodDescriptionstatic TypeSafeConfigBuilderbuilder()static TypeSafeConfigempty()envOverrides(boolean envOverrides) booleanstatic TypeSafeConfigstatic TypeSafeConfigstatic TypeSafeConfigstatic TypeSafeConfigstatic TypeSafeConfigfrom(@NonNull Properties properties) static TypeSafeConfigfrom(@NonNull Properties properties, String name) Creates a config from JavaProperties, converting them to a map-backed TypeSafe Config with PROPERTIES syntax origin.getBoolean(@NonNull String name) Retrieves a size-in-bytes config value with environment variable override support.com.typesafe.config.ConfigOptional<com.typesafe.config.Config> getDuration(@NonNull String name) Retrieves a duration config value with environment variable override support.getDuration(@NonNull String name, @NonNull Duration defaultValue) intgetInteger(@NonNull String name) longgetName()Retrieves a string config value with environment variable override support.getStringList(@NonNull String name) Retrieves a string list with environment override and type fallback.getTypeSafeConfig(@NonNull String name) inthashCode()booleanbooleanbooleanbooleanisEmpty()static TypeSafeConfigof(com.typesafe.config.Config config) toMap()toString()withOverrides(@NonNull TypeSafeConfig overrides) Returns a new TypeSafeConfig where values fromoverridestake priority over values in this config, with missing keys falling back to this config.
-
Constructor Details
-
TypeSafeConfig
public TypeSafeConfig(@NonNull @NonNull com.typesafe.config.Config config) -
TypeSafeConfig
-
TypeSafeConfig
public TypeSafeConfig(@NonNull @NonNull com.typesafe.config.Config config, String name, boolean envOverrides)
-
-
Method Details
-
of
-
empty
-
from
-
from
-
from
-
from
Creates a config from JavaProperties, converting them to a map-backed TypeSafe Config with PROPERTIES syntax origin.- Parameters:
properties- the source propertiesname- optional config name- Returns:
- a new TypeSafeConfig instance
-
from
-
from
-
builder
-
isEmpty
public boolean isEmpty() -
withOverrides
Returns a new TypeSafeConfig where values fromoverridestake priority over values in this config, with missing keys falling back to this config.- Parameters:
overrides- config whose values take priority; if empty, returns this unchanged- Returns:
- merged config with overrides applied
-
envOverrides
-
hasPath
-
getString
-
getString
Retrieves a string config value with environment variable override support. WhenenvOverridesis enabled, checks for an environment variable matching the uppercase config key before falling back to the config file value.- Parameters:
name- the config key (also used as env var name in uppercase)- Returns:
- the resolved value, or empty if not found in either source
-
getInt
-
getInteger
-
getLong
-
getLong
-
getDuration
-
getDuration
Retrieves a duration config value with environment variable override support. WhenenvOverridesis enabled, an environment variable matching the key (seegetEnv(String)) takes priority and is parsed with the same HOCON duration syntax as file values (e.g."30s","5m"). Historically this getter ignored env vars entirely — the #222 config-drift class, whereSOME_TIMEOUT=30ssilently had no effect.- Parameters:
name- the config key (also used as env var name, seegetEnv(String))- Returns:
- the resolved duration, or empty if not found in either source
-
getBytes
Retrieves a size-in-bytes config value with environment variable override support. WhenenvOverridesis enabled, an environment variable matching the key (seegetEnv(String)) takes priority and is parsed with the same HOCON size syntax as file values (e.g."1024","10MB"). Historically this getter ignored env vars entirely (T5.1).- Parameters:
name- the config key (also used as env var name, seegetEnv(String))- Returns:
- the resolved byte count, or empty if not found in either source
-
is
-
is
-
getBoolean
-
getConfig
-
getTypeSafeConfig
-
getStringList
Retrieves a string list with environment override and type fallback. Resolution order: (1) env var parsed as comma/semicolon-delimited list, (2) config list value, (3) if config value is a single string instead of a list, splits it into a list. Returns empty list if key is not found.- Parameters:
name- the config key- Returns:
- the resolved list, or empty list if not found
-
getEnv
-
toMap
-
equals
-
hashCode
-
toString
-
getConfig
public com.typesafe.config.Config getConfig() -
getName
-