Interface VariableSubstitutor
- All Known Implementing Classes:
VariableSubstitutorImpl
public interface VariableSubstitutor
A stateful object that handles variable substitution.
It maintains its state of variables.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocalVariable
(@NotNull String key, @NotNull String value) Add a local variable to current context.findAllVariables
(@Nullable String string) Finds all variables in the stringIf current context is releated to aBuildContext
return all the automatic variables related to repositories.Returns all variables used in string substitution during this object's lifetime@NotNull Map<String,
VariableDefinitionContext> Get all variables in current context@NotNull String
removeAllVariables
(@NotNull String value) Given a string, remove all variable patterns.@Nullable String
substituteString
(@Nullable String value) Substitutes variables in the input string with their values using data from existing state.
-
Method Details
-
substituteString
@Contract("null -> null; !null -> !null") @Nullable @Nullable String substituteString(@Nullable @Nullable String value) Substitutes variables in the input string with their values using data from existing state.- Parameters:
value
- input string- Returns:
- substituted string
-
findAllVariables
Finds all variables in the string- Parameters:
string
- String value to be analyzed- Returns:
- collection of variable names found in the string
-
removeAllVariables
Given a string, remove all variable patterns.- Parameters:
value
- string values to be analyzed- Returns:
- value with variables removed
-
addLocalVariable
Add a local variable to current context.- Parameters:
key
-value
-
-
getVariableContexts
Get all variables in current context -
getSubstitutedVariables
Map<String,VariableSubstitutionContext> getSubstitutedVariables()Returns all variables used in string substitution during this object's lifetime -
getBuiltInRepositoryVariablesIfBuildContext
Map<String,VariableDefinitionContext> getBuiltInRepositoryVariablesIfBuildContext()If current context is releated to aBuildContext
return all the automatic variables related to repositories. Return empty map otherwise.
-