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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addLocalVariable(@NotNull String key, @NotNull String value)
Add a local variable to current context.@NotNull Set<String>
findAllVariables(@Nullable String string)
Finds all variables in the stringMap<String,VariableDefinitionContext>
getBuiltInRepositoryVariablesIfBuildContext()
If current context is releated to aBuildContext
return all the automatic variables related to repositories.Map<String,VariableSubstitutionContext>
getSubstitutedVariables()
Returns all variables used in string substitution during this object's lifetime@NotNull Map<String,VariableDefinitionContext>
getVariableContexts()
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 Detail
-
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
@NotNull @NotNull Set<String> findAllVariables(@Nullable @Nullable String string)
Finds all variables in the string- Parameters:
string
- String value to be analyzed- Returns:
- collection of variable names found in the string
-
removeAllVariables
@NotNull @NotNull String removeAllVariables(@NotNull @NotNull String value)
Given a string, remove all variable patterns.- Parameters:
value
- string values to be analyzed- Returns:
- value with variables removed
-
addLocalVariable
void addLocalVariable(@NotNull @NotNull String key, @NotNull @NotNull String value)
Add a local variable to current context.- Parameters:
key
-value
-
-
getVariableContexts
@NotNull @NotNull Map<String,VariableDefinitionContext> 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.
-
-