Package software.amazon.awssdk.utils
Interface SystemSetting
-
- All Known Implementing Classes:
JavaSystemSetting
,ProxyEnvironmentSetting
,ProxySystemSetting
public interface SystemSetting
An interface implemented by enums in other packages in order to define the system settings the want loaded. An enum is expected to implement this interface, and then have values loaded from theSystem
using methods likegetStringValue()
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
defaultValue()
The default value of the setting (or empty if there is no default).String
environmentVariable()
The environment variable of the setting (or null if there is no environment variable for this setting).default Optional<Boolean>
getBooleanValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
.default Boolean
getBooleanValueOrThrow()
Load the requested system setting as per the documentation ingetBooleanValue()
, throwing an exception if the value was not set and had no default.default Optional<Integer>
getIntegerValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
.default Integer
getIntegerValueOrThrow()
Load the requested system setting as per the documentation ingetIntegerValue()
, throwing an exception if the value was not set and had no default.default Optional<String>
getNonDefaultStringValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
.default Optional<String>
getStringValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
.static Optional<String>
getStringValueFromEnvironmentVariable(String key)
Attempt to load a system setting fromSystem.getenv(String)
.default String
getStringValueOrThrow()
Load the requested system setting as per the documentation ingetStringValue()
, throwing an exception if the value was not set and had no default.String
property()
The system property of the setting (or null if there is no property for this setting).
-
-
-
Method Detail
-
property
String property()
The system property of the setting (or null if there is no property for this setting).
-
environmentVariable
String environmentVariable()
The environment variable of the setting (or null if there is no environment variable for this setting).
-
defaultValue
String defaultValue()
The default value of the setting (or empty if there is no default). This value will be applied if the customer did not specify a setting.
-
getStringValue
default Optional<String> getStringValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
. This should be used in favor of those methods because the SDK should support both methods of configuration.System.getProperty(String)
takes precedent overSystem.getenv(String)
if both are specified.- Returns:
- The requested setting, or
Optional.empty()
if the values were not set, or the security manager did not allow reading the setting.
-
getStringValueFromEnvironmentVariable
static Optional<String> getStringValueFromEnvironmentVariable(String key)
Attempt to load a system setting fromSystem.getenv(String)
. This should NOT BE USED, so checkstyle will complain about using it. The only reason this is made available is for when we ABSOLUTELY CANNOT support a system property for a specific setting. That should be the exception, NOT the rule. We should almost always provide a system property alternative for all environment variables.- Returns:
- The requested setting, or
Optional.empty()
if the values were not set, or the security manager did not allow reading the setting.
-
getNonDefaultStringValue
default Optional<String> getNonDefaultStringValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
. This should be used in favor of those methods because the SDK should support both methods of configuration.System.getProperty(String)
takes precedent overSystem.getenv(String)
if both are specified.Similar to
getStringValue()
, but does not fall back to the default value.- Returns:
- The requested setting, or
Optional.empty()
if the values were not set, or the security manager did not allow reading the setting.
-
getStringValueOrThrow
default String getStringValueOrThrow()
Load the requested system setting as per the documentation ingetStringValue()
, throwing an exception if the value was not set and had no default.- Returns:
- The requested setting.
-
getIntegerValue
default Optional<Integer> getIntegerValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
. This should be used in favor of those methods because the SDK should support both methods of configuration. The result will be converted to an integer.System.getProperty(String)
takes precedent overSystem.getenv(String)
if both are specified.- Returns:
- The requested setting, or
Optional.empty()
if the values were not set, or the security manager did not allow reading the setting.
-
getIntegerValueOrThrow
default Integer getIntegerValueOrThrow()
Load the requested system setting as per the documentation ingetIntegerValue()
, throwing an exception if the value was not set and had no default.- Returns:
- The requested setting.
-
getBooleanValue
default Optional<Boolean> getBooleanValue()
Attempt to load a system setting fromSystem.getProperty(String)
andSystem.getenv(String)
. This should be used in favor of those methods because the SDK should support both methods of configuration. The result will be converted to a boolean.System.getProperty(String)
takes precedent overSystem.getenv(String)
if both are specified.- Returns:
- The requested setting, or
Optional.empty()
if the values were not set, or the security manager did not allow reading the setting.
-
getBooleanValueOrThrow
default Boolean getBooleanValueOrThrow()
Load the requested system setting as per the documentation ingetBooleanValue()
, throwing an exception if the value was not set and had no default.- Returns:
- The requested setting.
-
-