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 protectedVariableSubstitutorImpl(@NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @Nullable VariableDefinitionManager variableDefinitionManager, @NotNull VcsRepositoryManager vcsRepositoryManager)protectedVariableSubstitutorImpl(@NotNull ImmutablePlan immutablePlan, @NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @NotNull VariableDefinitionManager variableDefinitionManager, @NotNull VcsRepositoryManager vcsRepositoryManager)protectedVariableSubstitutorImpl(@NotNull CommonContext commonContext, @NotNull BuildLoggerManager buildLoggerManager, @Nullable CapabilityContext capabilityContext, @NotNull AgentContext agentContext, @NotNull BuildDirectoryManager buildDirectoryManager, @NotNull BambooUrl bambooUrl, @NotNull CustomVariableContext customVariableContext, @NotNull VcsRepositoryManager vcsRepositoryManager, boolean createLocalCopyOfVariableContext)protectedVariableSubstitutorImpl(@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 voidaddLocalVariable(@NotNull String key, @NotNull String value)Add a local variable to current context.@NotNull Set<String>findAllVariables(@Nullable String string)Given a string, and aMapof 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 aBuildContextreturn 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 StringremoveAllVariables(@NotNull String value)Given a string, remove all variable patterns.@Nullable StringsubstituteString(@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, boolean createLocalCopyOfVariableContext)
-
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:VariableSubstitutorSubstitutes variables in the input string with their values using data from existing state.- Specified by:
substituteStringin interfaceVariableSubstitutor- Parameters:
value- input string- Returns:
- substituted string
-
getSubstitutedVariables
public Map<String,VariableSubstitutionContext> getSubstitutedVariables()
Description copied from interface:VariableSubstitutorReturns all variables used in string substitution during this object's lifetime- Specified by:
getSubstitutedVariablesin interfaceVariableSubstitutor
-
removeAllVariables
@NotNull public @NotNull String removeAllVariables(@NotNull @NotNull String value)
Description copied from interface:VariableSubstitutorGiven a string, remove all variable patterns.- Specified by:
removeAllVariablesin 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 aMapof variables (variable -> value), all patterns in the string array matching ${bamboo.<variable>} will be substituted with the value.- Specified by:
findAllVariablesin 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:VariableSubstitutorAdd a local variable to current context.- Specified by:
addLocalVariablein interfaceVariableSubstitutor
-
getVariableContexts
@NotNull public @NotNull Map<String,VariableDefinitionContext> getVariableContexts()
Description copied from interface:VariableSubstitutorGet all variables in current context- Specified by:
getVariableContextsin interfaceVariableSubstitutor
-
getBuiltInRepositoryVariablesIfBuildContext
public Map<String,VariableDefinitionContext> getBuiltInRepositoryVariablesIfBuildContext()
Description copied from interface:VariableSubstitutorIf current context is releated to aBuildContextreturn all the automatic variables related to repositories. Return empty map otherwise.- Specified by:
getBuiltInRepositoryVariablesIfBuildContextin interfaceVariableSubstitutor
-
-