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 SummaryFields Modifier and Type Field Description java.lang.Stringkey
 - 
Constructor SummaryConstructors Constructor Description Builder(java.lang.String envKey)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description EnvironmentVariablebuild()Create an EnvironmentVariable object matching the composed specifications from the Builder.EnvironmentVariable.BuilderdefaultValue(java.lang.String defaultValue)Sets a default (fallback) value for the EnvironmentVariable object if not found.EnvironmentVariable.Builderpattern(java.util.regex.Pattern expectedPattern)Sets a regex pattern to be used for validating the environment variable value.EnvironmentVariable.Buildersubstitution(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.EnvironmentVariable.Buildersubstitution(java.util.regex.Pattern matchingPattern, java.lang.String replacementValue)Add a Pattern to the substitution map that will be checked for an _explicit_ match and translate the retrieved value when resolved.EnvironmentVariable.Buildertransform(java.util.function.Function<java.lang.String,java.lang.String> transformFunction)Register a Transform Function that will be applied after configured substitutions are performed against the resolved Environment Variable value.
 
- 
- 
- 
Method Detail- 
patternpublic 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
 
 - 
defaultValuepublic 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
 
 - 
substitutionpublic 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. NOTE: Insertion order of substitutions is not tracked; avoid duplicate substitutions- Parameters:
- originalValue- is the value to substitute when found
- replacementValue- is the replacement value that will be applied
- Returns:
- Builder object with an updated substitution map.
 
 - 
substitutionpublic EnvironmentVariable.Builder substitution(java.util.regex.Pattern matchingPattern, java.lang.String replacementValue) Add a Pattern to the substitution map that will be checked for an _explicit_ match and translate the retrieved value when resolved. NOTE: Insertion order of substitutions is not tracked; avoid duplicate substitutions- Parameters:
- matchingPattern- is a RegEx Pattern object that will be used to test for an explicit/full match
- replacementValue- is the replacement value that will be applied
- Returns:
- Builder object with an updated substitution map.
 
 - 
transformpublic EnvironmentVariable.Builder transform(java.util.function.Function<java.lang.String,java.lang.String> transformFunction) Register a Transform Function that will be applied after configured substitutions are performed against the resolved Environment Variable value. Only one transform function can be registered. WARNING: if null values are possible (i.e. no non-null default specified and env variable not found), then this transform function must handle null String input parameter on its own.- Parameters:
- transformFunction- accepts a String, performs some transformations and returns a String
- Returns:
- Builder object with a registered transform function.
 
 - 
buildpublic EnvironmentVariable build() Create an EnvironmentVariable object matching the composed specifications from the Builder.- Returns:
- EnvironmentVariable object that has already resolved its value.
 
 
- 
 
-