Package com.atlassian.bamboo.variable
Class VariableContextImpl
java.lang.Object
com.atlassian.bamboo.variable.VariableContextImpl
- All Implemented Interfaces:
ImmutableVariableContext
,VariableContext
,Serializable
@NotThreadSafe
public class VariableContextImpl
extends Object
implements VariableContext, Serializable
- See Also:
-
Constructor Summary
ConstructorDescriptionVariableContextImpl
(Map<String, VariableDefinitionContext> definitions) VariableContextImpl
(Map<String, VariableDefinitionContext> definitions, ImmutableVariableContext parentContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocalVariable
(@NotNull String key, @NotNull String value) Add generated local (a.k.a CUSTOM) variable to this context.void
addResultVariable
(@NotNull String key, @NotNull String value) Add generated result variable to this context.@NotNull Map<String,
VariableDefinitionContext> Effective state of the variables.@NotNull Map<String,
VariableDefinitionContext> Get initial state of this context, that is variables that are set at the creation of this context not including variables inherited from the parent context.@NotNull Map<String,
VariableDefinitionContext> The original state of variables in this context, that is, the state as it was when execution of job (environment) started, created from parent context (if applicable) and explicit 'initial state' of this context.Get parent context.Get all variables in current context that are considered "password" variables, i.e.@NotNull Map<String,
VariableDefinitionContext> @NotNull Map<String,
VariableSubstitutionContext> void
removeLocalVariable
(@NotNull String key)
-
Constructor Details
-
VariableContextImpl
public VariableContextImpl(Map<String, VariableDefinitionContext> definitions, @Nullable ImmutableVariableContext parentContext) -
VariableContextImpl
-
-
Method Details
-
getSubstitutions
- Specified by:
getSubstitutions
in interfaceVariableContext
- Returns:
- variables used in current build
-
getOriginalVariables
Description copied from interface:ImmutableVariableContext
The original state of variables in this context, that is, the state as it was when execution of job (environment) started, created from parent context (if applicable) and explicit 'initial state' of this context. See alsoImmutableVariableContext.getInitialState()
- Specified by:
getOriginalVariables
in interfaceImmutableVariableContext
- Returns:
- immutable state of the variables as it was when this object was created
-
getEffectiveVariables
Description copied from interface:ImmutableVariableContext
Effective state of the variables. This is calculated according to the following rules: - result variables hide variables from original state - local variables hide all other variables- Specified by:
getEffectiveVariables
in interfaceImmutableVariableContext
- Returns:
- immutable map containing effective state of variables in this context
-
getResultVariables
- Specified by:
getResultVariables
in interfaceImmutableVariableContext
- Returns:
- immutable map containing all result variables in this context
-
getParentContext
Description copied from interface:ImmutableVariableContext
Get parent context. Note that making changes to the parent context is not supported.- Specified by:
getParentContext
in interfaceImmutableVariableContext
-
getInitialState
Description copied from interface:ImmutableVariableContext
Get initial state of this context, that is variables that are set at the creation of this context not including variables inherited from the parent context.- Specified by:
getInitialState
in interfaceImmutableVariableContext
-
addResultVariable
Description copied from interface:VariableContext
Add generated result variable to this context. Result variables are persisted with the result and are available in subsequent stages of the plan and in deployment version created from a result. Result variables hide any global or plan variables (but their value is not changed). If a local variable exists with the same key, it will be removed. Calling this method second time with the same key assigns new value to the variable.- Specified by:
addResultVariable
in interfaceVariableContext
-
addLocalVariable
Description copied from interface:VariableContext
Add generated local (a.k.a CUSTOM) variable to this context. Local variables are only accessible from this context and are not persisted. Local variables hide any existing variables (but their value is not changed). However if you define a result variable with the same key after defining local variable, local variable will be removed. Calling this method second time with the same key assigns new value to the variable.- Specified by:
addLocalVariable
in interfaceVariableContext
-
removeLocalVariable
- Specified by:
removeLocalVariable
in interfaceVariableContext
-
getPasswordVariables
Description copied from interface:ImmutableVariableContext
Get all variables in current context that are considered "password" variables, i.e. contain string "password" in name.- Specified by:
getPasswordVariables
in interfaceImmutableVariableContext
-