com.atlassian.bamboo.variable.substitutor
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
 void addLocalVariable(String key, String value)
          Add a local variable to current context.
 Set<String> findAllVariables(String variable)
          Given a string, and a Map of variables (variable -> value), all patterns in the string array matching ${bamboo.} will be substituted with the value.
 Map<String,VariableDefinitionContext> getBuiltInRepositoryVariablesIfBuildContext()
          If current context is releated to a BuildContext return all the automatic variables related to repositories.
 Map<String,VariableSubstitutionContext> getSubstitutedVariables()
          Returns all variables used in string substitution during this object's lifetime
 Map<String,VariableDefinitionContext> getVariableContexts()
          Get all variables in current context
 String removeAllVariables(String value)
          Given a string, remove all variable patterns.
 String substituteString(String value)
          Substitutes variables in the input string with their values using data from existing state.
 

Method Detail

substituteString

@Contract(value="null -> null; !null -> !null")
@Nullable
String substituteString(@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
Set<String> findAllVariables(@Nullable
                                     String variable)
Given a string, and a Map of variables (variable -> value), all patterns in the string array matching ${bamboo.} will be substituted with the value.

Parameters:
variable - String value to be analyzed
Returns:
Set of string values with variables extrapolated

removeAllVariables

@NotNull
String removeAllVariables(@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
                      String key,
                      @NotNull
                      String value)
Add a local variable to current context.

Parameters:
key -
value -

getVariableContexts

@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 a BuildContext return all the automatic variables related to repositories. Return empty map otherwise.



Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.