Interface SystemSetting

All Known Implementing Classes:
JavaSystemSetting, ProfileFileSystemSetting, ProxyEnvironmentSetting, ProxySystemSetting, S3SystemSetting, SdkSystemSetting, TracingSystemSetting

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 the System using methods like getStringValue().
  • Method Details

    • 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 from System.getProperty(String) and System.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 over System.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 from System.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 from System.getProperty(String) and System.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 over System.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 in getStringValue(), 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 from System.getProperty(String) and System.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 over System.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 in getIntegerValue(), 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 from System.getProperty(String) and System.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 over System.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 in getBooleanValue(), throwing an exception if the value was not set and had no default.
      Returns:
      The requested setting.