Class ConfigurationOptionsExtractor


  • public class ConfigurationOptionsExtractor
    extends java.lang.Object
    A utility class for processing configuration items specified via system properties and/ environment variables.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Integer extractInt​(@NonNull java.lang.String systemProperty, @NonNull java.lang.String environmentVariable, @NonNull java.lang.Integer defaultValue)
      Extracts a configuration value as integer from the specified from system property or environment variable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigurationOptionsExtractor

        public ConfigurationOptionsExtractor()
    • Method Detail

      • extractInt

        public static java.lang.Integer extractInt​(@NonNull
                                                   @NonNull java.lang.String systemProperty,
                                                   @NonNull
                                                   @NonNull java.lang.String environmentVariable,
                                                   @NonNull
                                                   @NonNull java.lang.Integer defaultValue)
        Extracts a configuration value as integer from the specified from system property or environment variable. If both are specified, the value from system property is returned. If neither are specified, it returns the {code defaultValue}. If the configuration value isn't an integer, it returns the default value.
        Parameters:
        systemProperty - the system property to extract the configuration value from
        environmentVariable - the environment variable to extract the configuration value from
        defaultValue - the value to be returned if neither systemProperty or environmentVariable is specified
        Returns:
        the specified or default configuration value