Package com.helger.config.source.envvar
Class EnvVarHelper
java.lang.Object
com.helger.config.source.envvar.EnvVarHelper
Helper functions for environment variables
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charstatic final char -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetUnifiedSysEnvName(String sName, char cReplacement) Get a unified system environment variable name from the provided property name.static booleanisValidFirstChar(char c) Check if the provided character is a valid first character for an environment variable.static booleanisValidFollowingChar(char c) Check if the provided character is a valid second or following character for an environment variable.
-
Field Details
-
DEFAULT_REPLACEMENT_CHAR
public static final char DEFAULT_REPLACEMENT_CHAR- See Also:
-
REPLACEMENT_CHAR_TO_SKIP
public static final char REPLACEMENT_CHAR_TO_SKIP- See Also:
-
-
Method Details
-
isValidFirstChar
public static boolean isValidFirstChar(char c) Check if the provided character is a valid first character for an environment variable.- Parameters:
c- The character to check- Returns:
trueif it is valid,falseif not
-
isValidFollowingChar
public static boolean isValidFollowingChar(char c) Check if the provided character is a valid second or following character for an environment variable.- Parameters:
c- The character to check- Returns:
trueif it is valid,falseif not
-
getUnifiedSysEnvName
@Nonnull public static String getUnifiedSysEnvName(@Nonnull @Nonempty String sName, char cReplacement) Get a unified system environment variable name from the provided property name. This means uppercasing all characters and replacing invalid chars with a replacement character.- Parameters:
sName- The property name to convert. May neither benullnor empty.cReplacement- The character that should be used to replace invalid characters. SeeDEFAULT_REPLACEMENT_CHAR. If character ` ยด is used, the invalid character is simply ignored. SeeREPLACEMENT_CHAR_TO_SKIP.- Returns:
- The
-