Class Config

java.lang.Object
dev.pfaff.glass.Config

public final class Config extends Object
Runtime configuration utilities.
  • Constructor Details

    • Config

      public Config()
  • Method Details

    • getEnvFlag

      public static boolean getEnvFlag(String name, boolean defaultValue)
      Parses the value of the environment variable name as a boolean where false is parsed from 0 and true is parsed from 1.
      Parameters:
      name - the name of the environment variable.
      defaultValue - the value that should be returned if the environment variable is unset.
      Returns:
      true if the variable is set to 1, false if the variable is set to 0, or defaultValue otherwise.
    • getEnvString

      public static String getEnvString(String name, String defaultValue)
    • getEnvInt

      public static int getEnvInt(String name, int defaultValue)
    • getEnvLong

      public static long getEnvLong(String name, long defaultValue)
    • getEnvT

      public static <T> T getEnvT(String name, T defaultValue, Function<String,T> parser)