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
ConstructorsConstructorDescriptionVariableContextImpl(Map<String, VariableDefinitionContext> definitions) VariableContextImpl(Map<String, VariableDefinitionContext> definitions, ImmutableVariableContext parentContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocalVariable(@NotNull String key, @NotNull String value) Add generated local (a.k.a CUSTOM) variable to this context.voidaddResultVariable(@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> voidremoveLocalVariable(@NotNull String key)
-
Constructor Details
-
VariableContextImpl
public VariableContextImpl(Map<String, VariableDefinitionContext> definitions, @Nullable ImmutableVariableContext parentContext) -
VariableContextImpl
-
-
Method Details
-
getSubstitutions
- Specified by:
getSubstitutionsin interfaceVariableContext- Returns:
- variables used in current build
-
getOriginalVariables
Description copied from interface:ImmutableVariableContextThe 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:
getOriginalVariablesin interfaceImmutableVariableContext- Returns:
- immutable state of the variables as it was when this object was created
-
getEffectiveVariables
Description copied from interface:ImmutableVariableContextEffective 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:
getEffectiveVariablesin interfaceImmutableVariableContext- Returns:
- immutable map containing effective state of variables in this context
-
getResultVariables
- Specified by:
getResultVariablesin interfaceImmutableVariableContext- Returns:
- immutable map containing all result variables in this context
-
getParentContext
Description copied from interface:ImmutableVariableContextGet parent context. Note that making changes to the parent context is not supported.- Specified by:
getParentContextin interfaceImmutableVariableContext
-
getInitialState
Description copied from interface:ImmutableVariableContextGet 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:
getInitialStatein interfaceImmutableVariableContext
-
addResultVariable
Description copied from interface:VariableContextAdd 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:
addResultVariablein interfaceVariableContext
-
addLocalVariable
Description copied from interface:VariableContextAdd 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:
addLocalVariablein interfaceVariableContext
-
removeLocalVariable
- Specified by:
removeLocalVariablein interfaceVariableContext
-
getPasswordVariables
Description copied from interface:ImmutableVariableContextGet all variables in current context that are considered "password" variables, i.e. contain string "password" in name.- Specified by:
getPasswordVariablesin interfaceImmutableVariableContext
-