Class SystemEnv

java.lang.Object
org.apache.juneau.internal.SystemEnv

public class SystemEnv extends Object
Utility methods for accessing system properties and environment variables.
See Also:
  • Constructor Details

  • Method Details

    • env

      public static <T> T env(String name, T def)
      Looks up a system property or environment variable.

      First looks in system properties. Then converts the name to env-safe and looks in the system environment. Then returns the default if it can't be found.

      Type Parameters:
      T - The type to convert the value to.
      Parameters:
      name - The property name.
      def - The default value if not found.
      Returns:
      The default value.
    • env

      public static Optional<String> env(String name)
      Looks up a system property or environment variable.

      First looks in system properties. Then converts the name to env-safe and looks in the system environment. Then returns the default if it can't be found.

      Parameters:
      name - The property name.
      Returns:
      The value if found.