Class SystemSettingUtils
- java.lang.Object
-
- software.amazon.awssdk.utils.internal.SystemSettingUtils
-
public final class SystemSettingUtils extends Object
A set of static utility methods for shared code inSystemSetting
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<String>
resolveEnvironmentVariable(String key)
Attempt to load a key from the environment variables.static Optional<String>
resolveEnvironmentVariable(SystemSetting setting)
Attempt to load this setting from the environment variables.static Optional<String>
resolveNonDefaultSetting(SystemSetting setting)
Resolve the value of this system setting, loading it from the System by checking: The system properties. The environment variables.static Optional<String>
resolveSetting(SystemSetting setting)
Resolve the value of this system setting, loading it from the System by checking: The system properties. The environment variables. The default value.static Boolean
safeStringToBoolean(SystemSetting setting, String value)
Convert a string to boolean safely (as opposed to the less strictBoolean.parseBoolean(String)
).
-
-
-
Method Detail
-
resolveSetting
public static Optional<String> resolveSetting(SystemSetting setting)
Resolve the value of this system setting, loading it from the System by checking:- The system properties.
- The environment variables.
- The default value.
-
resolveNonDefaultSetting
public static Optional<String> resolveNonDefaultSetting(SystemSetting setting)
Resolve the value of this system setting, loading it from the System by checking:- The system properties.
- The environment variables.
This is similar to
resolveSetting(SystemSetting)
but does not fall back to the default value if neither the environment variable or system property value are present.
-
resolveEnvironmentVariable
public static Optional<String> resolveEnvironmentVariable(SystemSetting setting)
Attempt to load this setting from the environment variables.
-
resolveEnvironmentVariable
public static Optional<String> resolveEnvironmentVariable(String key)
Attempt to load a key from the environment variables.
-
safeStringToBoolean
public static Boolean safeStringToBoolean(SystemSetting setting, String value)
Convert a string to boolean safely (as opposed to the less strictBoolean.parseBoolean(String)
). If a customer specifies a boolean value it should be "true" or "false" (case insensitive) or an exception will be thrown.
-
-