@PublicApi
public interface CustomVariableContext
ThreadLocal
state of available variables.
The state contains (if applicable):
- current Plan
- variable definitions (including Plan variables when applicable)
- BuildContext
- BuildLogger
Modifier and Type | Method and Description |
---|---|
void |
addCustomData(String key,
String value)
Adds a
VariableType.MANUAL variable to ThreadLocal state. |
void |
clearContext()
Deprecated.
|
Set<String> |
findAllVariables(String stringWithVariables)
Given a string, all patterns in the string matching ${bamboo.<variable>} or ${system.<variable>} will be found.
|
Map<String,VariableDefinitionContext> |
getBuildInRepositoryVariablesIfBuildContext()
Return variables all built-in variables produced by repository plugin for the current build context.
|
Map<String,VariableSubstitutionContext> |
getSubstitutedVariables()
Get all the variables that have previously been substituted in this thread.
|
Map<String,VariableDefinitionContext> |
getVariableContexts()
Get all variables from current thread local context.
|
VariableSubstitutorFactory |
getVariableSubstitutorFactory() |
String |
removeAllVariables(String unparsedString)
Given a string, remove all variable patterns.
|
void |
setPlan(ImmutablePlan plan)
Deprecated.
|
String |
substituteString(String value)
Substitutes variables in the input string with their values using data from existing
ThreadLocal state. |
<V,E1 extends Exception,E2 extends Exception,E3 extends Exception> |
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
BambooCallables.ThrowingX<V,E1,E2,E3> callable)
Run operation with provided
VariableSubstitutor in thread local context. |
<V> V |
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
Callable<V> callable)
Run operation with provided
VariableSubstitutor in thread local context. |
void |
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
Runnable runnable)
Run operation with provided
VariableSubstitutor in thread local context. |
<V> V |
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
Supplier<V> supplier)
Run operation with provided
VariableSubstitutor in thread local context. |
void addCustomData(String key, String value)
VariableType.MANUAL
variable to ThreadLocal
state.key
- name of the variablevalue
- value of the variable@Contract(value="null -> null; !null -> !null") String substituteString(@Nullable String value)
ThreadLocal
state.value
- input string@NotNull Map<String,VariableDefinitionContext> getVariableContexts()
@NotNull String removeAllVariables(@NotNull String unparsedString)
unparsedString
- string values to be analyzed@NotNull Map<String,VariableSubstitutionContext> getSubstitutedVariables()
@Deprecated void setPlan(@NotNull ImmutablePlan plan)
CustomVariableContextRunner
or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal
state.
Clears history of substituted variables (getSubstitutedVariables()
plan
- @Deprecated void clearContext()
CustomVariableContextRunner
or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal
state.@NotNull Set<String> findAllVariables(@Nullable String stringWithVariables)
stringWithVariables
- String value to be analyzed@NotNull Map<String,VariableDefinitionContext> getBuildInRepositoryVariablesIfBuildContext()
BuildContext
, otherwise returned map will be empty.
Note: variables are used in repository definition, they will be resolved according to current state of the CustomVariableContext
@NotNull VariableSubstitutorFactory getVariableSubstitutorFactory()
VariableSubstitutor
void withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull Runnable runnable)
VariableSubstitutor
in thread local context. Restore current thread local state when finished.<V> V withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull Callable<V> callable) throws Exception
VariableSubstitutor
in thread local context. Restore current thread local state when finished.Exception
<V> V withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull Supplier<V> supplier)
VariableSubstitutor
in thread local context. Restore current thread local state when finished.<V,E1 extends Exception,E2 extends Exception,E3 extends Exception> V withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull BambooCallables.ThrowingX<V,E1,E2,E3> callable) throws E1 extends Exception, E2 extends Exception, E3 extends Exception
VariableSubstitutor
in thread local context. Restore current thread local state when finished.E1 extends Exception
Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.