Class NBConfiguration

java.lang.Object
io.nosqlbench.nb.api.config.standard.NBConfiguration

public class NBConfiguration extends Object
  • Constructor Details

    • NBConfiguration

      protected NBConfiguration(NBConfigModel model, LinkedHashMap<String,Object> validConfig)
      Create a NBConfigReader from a known valid configuration and a config model. This method is restricted to encourage construction of readers only by passing through the friendly NBConfigModel.apply(Map) method.
      Parameters:
      model - A configuration model, describing what is allowed to be configured by name and type.
      validConfig - A valid config reader.
  • Method Details

    • getModel

      public NBConfigModel getModel()
    • empty

      public static NBConfiguration empty()
    • getEnvOptional

      public Optional<String> getEnvOptional(String name)
      Returns the value of the named parameter as getOptional(String), so long as no env vars were reference OR all env var references were found.
      Parameters:
      name - The name of the variable to look up
      Returns:
      An optional value, if present and (optionally) interpolated correctly from the environment
    • getWithEnv

      public String getWithEnv(String name)
    • getWithEnv

      public <T> T getWithEnv(String name, Class<? extends T> vclass)
    • get

      public <T> T get(String name)
      Get a config value or object by name. This uses type inference (as a generic method) in addition to the internal model for type checking and ergonomic use. If you do not call this within an assignment or context where the Java compiler knows what type you are expecting, then use get(String, Class) instead.
      Type Parameters:
      T - The (inferred) generic type of the configuration value
      Parameters:
      name - The name of the configuration parameter
      Returns:
      The value of type T, matching the config model type for the provided field name
    • get

      public <T> T get(String name, Class<? extends T> type)
    • getOptional

      public Optional<String> getOptional(String name)
    • getOptional

      public Optional<String> getOptional(String... names)
    • getOptional

      public <T> Optional<T> getOptional(Class<T> type, String... names)
    • getOrDefault

      public <T> T getOrDefault(String name, T defaultValue)
    • param

      public <T> T param(String name, Class<? extends T> vclass)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
    • getMap

      public LinkedHashMap<String,Object> getMap()