Class EnvironmentVariable.Builder
- java.lang.Object
-
- com.inductiveautomation.ignition.common.config.EnvironmentVariable.Builder
-
- Enclosing class:
- EnvironmentVariable
public static class EnvironmentVariable.Builder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
key
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String envKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EnvironmentVariable
build()
Create an EnvironmentVariable object matching the composed specifications from the Builder.EnvironmentVariable.Builder
defaultValue(java.lang.String defaultValue)
Sets a default (fallback) value for the EnvironmentVariable object if not found.EnvironmentVariable.Builder
pattern(java.util.regex.Pattern expectedPattern)
Sets a regex pattern to be used for validating the environment variable value.EnvironmentVariable.Builder
substitution(java.lang.String originalValue, java.lang.String replacementValue)
Add an entry to the substitution map that will be used to translate the retrieved value when resolved.
-
-
-
Method Detail
-
pattern
public EnvironmentVariable.Builder pattern(java.util.regex.Pattern expectedPattern)
Sets a regex pattern to be used for validating the environment variable value. Default value (if defined) will be used if value does not match expected pattern.- Parameters:
expectedPattern
- is the RegEx Pattern object that will be tested for match against value- Returns:
- Builder object with applied pattern
-
defaultValue
public EnvironmentVariable.Builder defaultValue(java.lang.String defaultValue)
Sets a default (fallback) value for the EnvironmentVariable object if not found.- Parameters:
defaultValue
- is an optional fallback value presented by getValue() if env var not resolved in env.- Returns:
- Builder object with applied default value
-
substitution
public EnvironmentVariable.Builder substitution(java.lang.String originalValue, java.lang.String replacementValue)
Add an entry to the substitution map that will be used to translate the retrieved value when resolved.- Parameters:
originalValue
- is the value to substitute when foundreplacementValue
- is the replacement value that will be applied- Returns:
- Builder object with an updated substitution map.
-
build
public EnvironmentVariable build()
Create an EnvironmentVariable object matching the composed specifications from the Builder.- Returns:
- EnvironmentVariable object that has already resolved its value.
-
-