Class ConfigUtils

java.lang.Object
com.atlassian.bamboo.utils.ConfigUtils

public class ConfigUtils extends Object
  • Field Details

    • BAMBOO_DELIMITER_PARSING_DISABLED

      public static final String BAMBOO_DELIMITER_PARSING_DISABLED
    • FIRST_ELEMENT_IN_LIST

      public static final String FIRST_ELEMENT_IN_LIST
    • SEPARATOR

      public static final String SEPARATOR
  • Method Details

    • copyMapToConfig

      public static void copyMapToConfig(@NotNull @NotNull Map<String,String> map, @NotNull @NotNull org.apache.commons.configuration.Configuration config)
    • copyObjectMapToConfig

      public static void copyObjectMapToConfig(@NotNull @NotNull Map<String,Object> map, @NotNull @NotNull org.apache.commons.configuration.Configuration config)
    • fromMap

      @NotNull public static @NotNull org.apache.commons.configuration.HierarchicalConfiguration fromMap(@NotNull @NotNull Map<String,?> map)
    • fromMap

      @NotNull public static <T extends org.apache.commons.configuration.Configuration> T fromMap(@NotNull @NotNull Map<String,?> map, @NotNull @NotNull Supplier<T> configSupplier)
    • asMap

      @NotNull public static @NotNull Map<String,String> asMap(@NotNull @NotNull org.apache.commons.configuration.Configuration config)
    • asMap

      @NotNull public static @NotNull Map<String,String> asMap(@NotNull @NotNull org.apache.commons.configuration.Configuration config, @Nullable @Nullable String filter)
    • asObjectMap

      public static Map<String,Object> asObjectMap(@NotNull @NotNull org.apache.commons.configuration.Configuration config)
    • asObjectMap

      @NotNull public static @NotNull Map<String,Object> asObjectMap(@NotNull @NotNull org.apache.commons.configuration.Configuration config, @Nullable @Nullable String filter)
    • 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

      public static void addMapToConfiguration(@NotNull @NotNull String mapConfigKey, @NotNull @NotNull String entryConfigKey, @NotNull @NotNull Map<String,String> map, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
    • addMapToConfiguration

      public static void addMapToConfiguration(@NotNull @NotNull String mapConfigKey, @NotNull @NotNull Map<String,String> map, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
    • 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

      @NotNull public static @NotNull Map<String,String> getMapFromConfiguration(@NotNull @NotNull String mapConfigKey, @NotNull @NotNull String entryConfigKey, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
    • getMapFromConfiguration

      @NotNull public static @NotNull Map<String,String> getMapFromConfiguration(@NotNull @NotNull String mapConfigKey, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
    • toStringMap

      @NotNull public static @NotNull Map<String,String> toStringMap(@NotNull @NotNull Map<String,?> objectsMap)
    • 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
      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. Use BuildConfiguration.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)
    • 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 property
      propertyName - name of the property
      propertyType - 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 property
      propertyName - name of the property
      propertyType - 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