Package com.atlassian.bamboo.variable
Class VariableUtils
java.lang.Object
com.atlassian.bamboo.variable.VariableUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String,
VariableDefinition> buildVariableDefinitionMap
(Collection<? extends VariableDefinition> variableDefinitions) Build map of VariableDefinition.getKey() -> VariableDefinition from a collection of VariableDefinitionsstatic boolean
containsVariableUsage
(@NotNull String text) Returns true if the given text contains variable usages from any namespace.static @NotNull List<VariableUsage>
findVariableUsages
(@NotNull String text) Finds all variable usages within a given text.static Map<String,
VariableDefinitionContext> identifiersToContextMap
(@NotNull Iterable<? extends VariableDefinitionIdentifier> ids) static boolean
isValidSecretVariable
(@Nullable String name, @Nullable String decryptedValue)
-
Method Details
-
identifiersToContextMap
public static Map<String,VariableDefinitionContext> identifiersToContextMap(@NotNull @NotNull Iterable<? extends VariableDefinitionIdentifier> ids) -
containsVariableUsage
Returns true if the given text contains variable usages from any namespace.
Variable usage consists of variable name, preceded by the namespace (usually "bamboo"), put between "${" and "}".
Example variable usages:
- ${bamboo.my.custom.variable} - ${bamboo.functionalTestOptions} - ${system.M2_HOME}
- Parameters:
text
- text to verify- Returns:
- true, if text contains variable usages, false otherwise
-
findVariableUsages
@NotNull public static @NotNull List<VariableUsage> findVariableUsages(@NotNull @NotNull String text) Finds all variable usages within a given text. -
buildVariableDefinitionMap
public static Map<String,VariableDefinition> buildVariableDefinitionMap(Collection<? extends VariableDefinition> variableDefinitions) Build map of VariableDefinition.getKey() -> VariableDefinition from a collection of VariableDefinitions -
isValidSecretVariable
public static boolean isValidSecretVariable(@Nullable @Nullable String name, @Nullable @Nullable String decryptedValue) - Parameters:
name
- variable namedecryptedValue
- variable value- Returns:
- if secret variable is valid, e.g. not multiline
-