Class VariableSubstitutorImpl
- java.lang.Object
-
- com.atlassian.bamboo.variable.substitutor.VariableSubstitutorImpl
-
- All Implemented Interfaces:
VariableSubstitutor
@NotThreadSafe public class VariableSubstitutorImpl extends Object implements VariableSubstitutor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VariableSubstitutorImpl(@NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @Nullable VariableDefinitionManager variableDefinitionManager, @NotNull VcsRepositoryManager vcsRepositoryManager)
protected
VariableSubstitutorImpl(@NotNull ImmutablePlan immutablePlan, @NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @NotNull VariableDefinitionManager variableDefinitionManager, @NotNull VcsRepositoryManager vcsRepositoryManager)
protected
VariableSubstitutorImpl(@NotNull CommonContext commonContext, @NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @NotNull CustomVariableContext customVariableContext, @NotNull VcsRepositoryManager vcsRepositoryManager)
protected
VariableSubstitutorImpl(@NotNull Map<String,VariableDefinitionContext> variablesContextMap, @NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @NotNull VcsRepositoryManager vcsRepositoryManager)
-
Method Summary
All Methods Instance Methods Concrete 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)
Given a string, and aMap
of variables (variable -> value), all patterns in the string array matching ${bamboo.<variable>} will be substituted with the value.Map<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.
-
-
-
Constructor Detail
-
VariableSubstitutorImpl
protected VariableSubstitutorImpl(@NotNull @NotNull BuildLoggerManager buildLoggerManager, @Nullable @Nullable CapabilityContext capabilityContext, @NotNull @NotNull AgentContext agentContext, @NotNull @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull @NotNull BambooUrl bambooUrl, @Nullable @Nullable VariableDefinitionManager variableDefinitionManager, @NotNull @NotNull VcsRepositoryManager vcsRepositoryManager)
-
VariableSubstitutorImpl
protected VariableSubstitutorImpl(@NotNull @NotNull ImmutablePlan immutablePlan, @NotNull @NotNull BuildLoggerManager buildLoggerManager, @Nullable @Nullable CapabilityContext capabilityContext, @NotNull @NotNull AgentContext agentContext, @NotNull @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull @NotNull BambooUrl bambooUrl, @NotNull @NotNull VariableDefinitionManager variableDefinitionManager, @NotNull @NotNull VcsRepositoryManager vcsRepositoryManager)
-
VariableSubstitutorImpl
protected VariableSubstitutorImpl(@NotNull @NotNull CommonContext commonContext, @NotNull @NotNull BuildLoggerManager buildLoggerManager, @Nullable @Nullable CapabilityContext capabilityContext, @NotNull @NotNull AgentContext agentContext, @NotNull @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull @NotNull BambooUrl bambooUrl, @NotNull @NotNull CustomVariableContext customVariableContext, @NotNull @NotNull VcsRepositoryManager vcsRepositoryManager)
-
VariableSubstitutorImpl
protected VariableSubstitutorImpl(@NotNull @NotNull Map<String,VariableDefinitionContext> variablesContextMap, @NotNull @NotNull BuildLoggerManager buildLoggerManager, @Nullable @Nullable CapabilityContext capabilityContext, @NotNull @NotNull AgentContext agentContext, @NotNull @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull @NotNull BambooUrl bambooUrl, @NotNull @NotNull VcsRepositoryManager vcsRepositoryManager)
-
-
Method Detail
-
substituteString
@Nullable public @Nullable String substituteString(@Nullable @Nullable String value)
Description copied from interface:VariableSubstitutor
Substitutes variables in the input string with their values using data from existing state.- Specified by:
substituteString
in interfaceVariableSubstitutor
- Parameters:
value
- input string- Returns:
- substituted string
-
getSubstitutedVariables
public Map<String,VariableSubstitutionContext> getSubstitutedVariables()
Description copied from interface:VariableSubstitutor
Returns all variables used in string substitution during this object's lifetime- Specified by:
getSubstitutedVariables
in interfaceVariableSubstitutor
-
removeAllVariables
@NotNull public @NotNull String removeAllVariables(@NotNull @NotNull String value)
Description copied from interface:VariableSubstitutor
Given a string, remove all variable patterns.- Specified by:
removeAllVariables
in interfaceVariableSubstitutor
- Parameters:
value
- string values to be analyzed- Returns:
- value with variables removed
-
findAllVariables
@NotNull public @NotNull Set<String> findAllVariables(@Nullable @Nullable String string)
Given a string, and aMap
of variables (variable -> value), all patterns in the string array matching ${bamboo.<variable>} will be substituted with the value.- Specified by:
findAllVariables
in interfaceVariableSubstitutor
- Parameters:
string
- String value to be analyzed- Returns:
- Array of string values with variables extrapolated
-
addLocalVariable
public void addLocalVariable(@NotNull @NotNull String key, @NotNull @NotNull String value)
Description copied from interface:VariableSubstitutor
Add a local variable to current context.- Specified by:
addLocalVariable
in interfaceVariableSubstitutor
-
getVariableContexts
@NotNull public @NotNull Map<String,VariableDefinitionContext> getVariableContexts()
Description copied from interface:VariableSubstitutor
Get all variables in current context- Specified by:
getVariableContexts
in interfaceVariableSubstitutor
-
getBuiltInRepositoryVariablesIfBuildContext
public Map<String,VariableDefinitionContext> getBuiltInRepositoryVariablesIfBuildContext()
Description copied from interface:VariableSubstitutor
If current context is releated to aBuildContext
return all the automatic variables related to repositories. Return empty map otherwise.- Specified by:
getBuiltInRepositoryVariablesIfBuildContext
in interfaceVariableSubstitutor
-
-