Package com.atlassian.bamboo.utils
Class ConfigUtils
java.lang.Object
com.atlassian.bamboo.utils.ConfigUtils
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addMapToBuilConfiguration
(@NotNull String mapKey, @NotNull Map<String, String> map, @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration) Deprecated.static void
addMapToConfiguration
(@NotNull String mapConfigKey, @NotNull String entryConfigKey, @NotNull Map<String, String> map, @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration) static void
addMapToConfiguration
(@NotNull String mapConfigKey, @NotNull Map<String, String> map, @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration) static void
addNodeAt
(org.apache.commons.configuration.HierarchicalConfiguration configuration, String rootPath, org.apache.commons.configuration.HierarchicalConfiguration configToAdd) static void
addNodesAt
(org.apache.commons.configuration.HierarchicalConfiguration config, String rootPath, org.apache.commons.configuration.HierarchicalConfiguration configToAdd) asMap
(@NotNull org.apache.commons.configuration.Configuration config) asObjectMap
(@NotNull org.apache.commons.configuration.Configuration config) asObjectMap
(@NotNull org.apache.commons.configuration.Configuration config, @Nullable String filter) static String
asXmlString
(@NotNull org.apache.commons.configuration.HierarchicalConfiguration hierarchicalConfiguration) Deprecated.does not preserve bambooDelimiterParsing disabled property correctly.static @NotNull String
asXmlString
(@NotNull org.apache.commons.configuration.XMLConfiguration configuration) static void
copyMapToConfig
(@NotNull Map<String, String> map, @NotNull org.apache.commons.configuration.Configuration config) static void
copyNodes
(@NotNull org.apache.commons.configuration.HierarchicalConfiguration sourceConfig, @NotNull org.apache.commons.configuration.HierarchicalConfiguration targetConfig) static void
copyNodes
(@NotNull org.apache.commons.configuration.HierarchicalConfiguration sourceConfig, @NotNull org.apache.commons.configuration.HierarchicalConfiguration targetConfig, @Nullable String key) static void
copyObjectMapToConfig
(@NotNull Map<String, Object> map, @NotNull org.apache.commons.configuration.Configuration config) static @NotNull org.apache.commons.configuration.HierarchicalConfiguration
static <T extends org.apache.commons.configuration.Configuration>
TgetMapFromConfiguration
(@NotNull String mapConfigKey, @NotNull String entryConfigKey, @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration) getMapFromConfiguration
(@NotNull String mapConfigKey, @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration) static <T> @NotNull List<T>
getPropertyAsList
(@NotNull Map<String, Object> configuration, @NotNull String propertyName, @NotNull Class<T> propertyType) Returns a given property from the configuration as a list of given type.static <T> @NotNull List<T>
getPropertyAsList
(@NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration, @NotNull String propertyName, @NotNull Class<T> propertyType) Returns a given property from the configuration as a list of given type.static @NotNull org.apache.commons.configuration.XMLConfiguration
getXmlConfigFromXmlString
(@NotNull String xmlData) static @NotNull org.apache.commons.configuration.XMLConfiguration
getXmlConfigFromXmlString
(@NotNull String xmlData, boolean delimiterParsingDisabled) Deprecated.since 5.2 use $getXmlConfigFromXmlString(java.lang.String)
static org.apache.commons.configuration.XMLConfiguration
static org.apache.commons.configuration.XMLConfiguration
newConfiguration
(boolean isDelimiterParsingDisabled) static org.apache.commons.configuration.XMLConfiguration
newConfiguration
(org.apache.commons.configuration.HierarchicalConfiguration configuration) static void
sanitiseAndSave
(@NotNull org.apache.commons.configuration.XMLConfiguration configuration, @NotNull Writer buildXml) Deprecated.toStringMap
(@NotNull Map<String, ?> objectsMap)
-
Field Details
-
BAMBOO_DELIMITER_PARSING_DISABLED
-
FIRST_ELEMENT_IN_LIST
-
SEPARATOR
-
-
Method Details
-
copyMapToConfig
-
copyObjectMapToConfig
-
fromMap
-
fromMap
-
asMap
-
asMap
-
asObjectMap
-
asObjectMap
-
addNodesAt
public static void addNodesAt(org.apache.commons.configuration.HierarchicalConfiguration config, String rootPath, org.apache.commons.configuration.HierarchicalConfiguration configToAdd) -
addNodeAt
public static void addNodeAt(org.apache.commons.configuration.HierarchicalConfiguration configuration, String rootPath, org.apache.commons.configuration.HierarchicalConfiguration configToAdd) -
addMapToConfiguration
-
addMapToConfiguration
-
addMapToBuilConfiguration
@Deprecated public static void addMapToBuilConfiguration(@NotNull @NotNull String mapKey, @NotNull @NotNull Map<String, String> map, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration) -
getMapFromConfiguration
-
getMapFromConfiguration
-
toStringMap
-
toLongMap
@NotNull public static @NotNull Map<String,Long> toLongMap(@NotNull @NotNull Map<String, String> stringMap) throws NumberFormatException- Throws:
NumberFormatException
-
sanitiseAndSave
@Deprecated public static void sanitiseAndSave(@NotNull @NotNull org.apache.commons.configuration.XMLConfiguration configuration, @NotNull @NotNull Writer buildXml) throws org.apache.commons.configuration.ConfigurationException Deprecated.- Throws:
org.apache.commons.configuration.ConfigurationException
-
asXmlString
@Deprecated public static String asXmlString(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration hierarchicalConfiguration) Deprecated.does not preserve bambooDelimiterParsing disabled property correctly. Avoid, especially when manipulating build configuration. UseBuildConfiguration.asXml()
instead. -
asXmlString
@NotNull public static @NotNull String asXmlString(@NotNull @NotNull org.apache.commons.configuration.XMLConfiguration configuration) -
getXmlConfigFromXmlString
@NotNull public static @NotNull org.apache.commons.configuration.XMLConfiguration getXmlConfigFromXmlString(@NotNull @NotNull String xmlData) -
getXmlConfigFromXmlString
@Deprecated @NotNull public static @NotNull org.apache.commons.configuration.XMLConfiguration getXmlConfigFromXmlString(@NotNull @NotNull String xmlData, boolean delimiterParsingDisabled) Deprecated.since 5.2 use $getXmlConfigFromXmlString(java.lang.String)
-
copyNodes
public static void copyNodes(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration sourceConfig, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration targetConfig) -
copyNodes
public static void copyNodes(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration sourceConfig, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration targetConfig, @Nullable @Nullable String key) -
newConfiguration
public static org.apache.commons.configuration.XMLConfiguration newConfiguration() -
newConfiguration
public static org.apache.commons.configuration.XMLConfiguration newConfiguration(boolean isDelimiterParsingDisabled) -
newConfiguration
public static org.apache.commons.configuration.XMLConfiguration newConfiguration(org.apache.commons.configuration.HierarchicalConfiguration configuration) -
getPropertyAsList
@NotNull public static <T> @NotNull List<T> getPropertyAsList(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration, @NotNull @NotNull String propertyName, @NotNull @NotNull Class<T> propertyType) Returns a given property from the configuration as a list of given type. This method acts as a utility to handle cases when the property value is either an iterable, an array, or a single element (in which case a one-element list is returned). If the property is not found in the configuration, an empty list is returned.- Parameters:
configuration
- configuration to fetch propertypropertyName
- name of the propertypropertyType
- expected type of each element from the property value as a list- Returns:
- a list of values of the specified property from the configuration; may be immutable
- Throws:
ClassCastException
- if the provided type is incorrect, e.g. the property is a list, but of a different type
-
getPropertyAsList
@NotNull public static <T> @NotNull List<T> getPropertyAsList(@NotNull @NotNull Map<String, Object> configuration, @NotNull @NotNull String propertyName, @NotNull @NotNull Class<T> propertyType) Returns a given property from the configuration as a list of given type. This method acts as a utility to handle cases when the property value is either an iterable, an array, or a single element (in which case a one-element list is returned). If the property is not found in the configuration, an empty list is returned.- Parameters:
configuration
- configuration to fetch propertypropertyName
- name of the propertypropertyType
- expected type of each element from the property value as a list- Returns:
- a list of values of the specified property from the configuration; may be immutable
- Throws:
ClassCastException
- if the provided type is incorrect, e.g. the property is a list, but of a different type
-
addMapToConfiguration(java.lang.String, java.lang.String, java.util.Map<java.lang.String, java.lang.String>, org.apache.commons.configuration.HierarchicalConfiguration)