Class ConfigUtils

java.lang.Object
org.eclipse.aether.util.ConfigUtils

public final class ConfigUtils extends Object
A utility class to read configuration properties from a repository system session.
See Also:
  • RepositorySystemSession.getConfigProperties()
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    getBoolean(Map<?,?> properties, boolean defaultValue, String... keys)
    Gets the specified configuration property.
    static boolean
    getBoolean(org.eclipse.aether.RepositorySystemSession session, boolean defaultValue, String... keys)
    Gets the specified configuration property.
    static float
    getFloat(Map<?,?> properties, float defaultValue, String... keys)
    Gets the specified configuration property.
    static float
    getFloat(org.eclipse.aether.RepositorySystemSession session, float defaultValue, String... keys)
    Gets the specified configuration property.
    static int
    getInteger(Map<?,?> properties, int defaultValue, String... keys)
    Gets the specified configuration property.
    static int
    getInteger(org.eclipse.aether.RepositorySystemSession session, int defaultValue, String... keys)
    Gets the specified configuration property.
    static List<?>
    getList(Map<?,?> properties, List<?> defaultValue, String... keys)
    Gets the specified configuration property.
    static List<?>
    getList(org.eclipse.aether.RepositorySystemSession session, List<?> defaultValue, String... keys)
    Gets the specified configuration property.
    static long
    getLong(Map<?,?> properties, long defaultValue, String... keys)
    Gets the specified configuration property.
    static long
    getLong(org.eclipse.aether.RepositorySystemSession session, long defaultValue, String... keys)
    Gets the specified configuration property.
    static Map<?,?>
    getMap(Map<?,?> properties, Map<?,?> defaultValue, String... keys)
    Gets the specified configuration property.
    static Map<?,?>
    getMap(org.eclipse.aether.RepositorySystemSession session, Map<?,?> defaultValue, String... keys)
    Gets the specified configuration property.
    static Object
    getObject(Map<?,?> properties, Object defaultValue, String... keys)
    Gets the specified configuration property.
    static Object
    getObject(org.eclipse.aether.RepositorySystemSession session, Object defaultValue, String... keys)
    Gets the specified configuration property.
    static String
    getString(Map<?,?> properties, String defaultValue, String... keys)
    Gets the specified configuration property.
    static String
    getString(org.eclipse.aether.RepositorySystemSession session, String defaultValue, String... keys)
    Gets the specified configuration property.
    static List<String>
    parseCommaSeparatedNames(String commaSeparatedNames)
    Utility method to parse configuration string that contains comma separated list of names into List<String>, never returns null.
    static List<String>
    Utility method to parse configuration string that contains comma separated list of names into List<String> with unique elements (duplicates, if any, are discarded), never returns null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getObject

      public static Object getObject(Map<?,?> properties, Object defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys are set, may be null.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a valid value is found.
      Returns:
      The property value or null if none.
    • getObject

      public static Object getObject(org.eclipse.aether.RepositorySystemSession session, Object defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys are set, may be null.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a valid value is found.
      Returns:
      The property value or null if none.
    • getString

      public static String getString(Map<?,?> properties, String defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a string, may be null.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a string value is found.
      Returns:
      The property value or null if none.
    • getString

      public static String getString(org.eclipse.aether.RepositorySystemSession session, String defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a string, may be null.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a string value is found.
      Returns:
      The property value or null if none.
    • getInteger

      public static int getInteger(Map<?,?> properties, int defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a number.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of an Integer is found.
      Returns:
      The property value.
    • getInteger

      public static int getInteger(org.eclipse.aether.RepositorySystemSession session, int defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a number.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of an Integer is found.
      Returns:
      The property value.
    • getLong

      public static long getLong(Map<?,?> properties, long defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a number.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Long is found.
      Returns:
      The property value.
    • getLong

      public static long getLong(org.eclipse.aether.RepositorySystemSession session, long defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a number.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Long is found.
      Returns:
      The property value.
    • getFloat

      public static float getFloat(Map<?,?> properties, float defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a number.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Float is found.
      Returns:
      The property value.
    • getFloat

      public static float getFloat(org.eclipse.aether.RepositorySystemSession session, float defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a number.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Float is found.
      Returns:
      The property value.
    • getBoolean

      public static boolean getBoolean(Map<?,?> properties, boolean defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a boolean.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Boolean or a string (to be parsed as boolean) is found.
      Returns:
      The property value.
    • getBoolean

      public static boolean getBoolean(org.eclipse.aether.RepositorySystemSession session, boolean defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a boolean.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a Boolean or a string (to be parsed as boolean) is found.
      Returns:
      The property value.
    • getList

      public static List<?> getList(Map<?,?> properties, List<?> defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a collection.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a collection is found.
      Returns:
      The property value or null if none.
    • getList

      public static List<?> getList(org.eclipse.aether.RepositorySystemSession session, List<?> defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a collection.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a collection is found.
      Returns:
      The property value or null if none.
    • getMap

      public static Map<?,?> getMap(Map<?,?> properties, Map<?,?> defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      properties - The configuration properties to read, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a map.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a map is found.
      Returns:
      The property value or null if none.
    • getMap

      public static Map<?,?> getMap(org.eclipse.aether.RepositorySystemSession session, Map<?,?> defaultValue, String... keys)
      Gets the specified configuration property.
      Parameters:
      session - The repository system session from which to read the configuration property, must not be null.
      defaultValue - The default value to return in case none of the property keys is set to a map.
      keys - The property keys to read, must not be null. The specified keys are read one after one until a map is found.
      Returns:
      The property value or null if none.
    • parseCommaSeparatedNames

      public static List<String> parseCommaSeparatedNames(String commaSeparatedNames)
      Utility method to parse configuration string that contains comma separated list of names into List<String>, never returns null.
      Since:
      1.9.0
    • parseCommaSeparatedUniqueNames

      public static List<String> parseCommaSeparatedUniqueNames(String commaSeparatedNames)
      Utility method to parse configuration string that contains comma separated list of names into List<String> with unique elements (duplicates, if any, are discarded), never returns null.
      Since:
      1.9.0