Package org.eclipse.aether.util
Class ConfigUtils
- java.lang.Object
-
- org.eclipse.aether.util.ConfigUtils
-
public final class ConfigUtils extends java.lang.Object
A utility class to read configuration properties from a repository system session.- See Also:
RepositorySystemSession.getConfigProperties()
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleangetBoolean(java.util.Map<?,?> properties, boolean defaultValue, java.lang.String... keys)Gets the specified configuration property.static booleangetBoolean(org.eclipse.aether.RepositorySystemSession session, boolean defaultValue, java.lang.String... keys)Gets the specified configuration property.static floatgetFloat(java.util.Map<?,?> properties, float defaultValue, java.lang.String... keys)Gets the specified configuration property.static floatgetFloat(org.eclipse.aether.RepositorySystemSession session, float defaultValue, java.lang.String... keys)Gets the specified configuration property.static intgetInteger(java.util.Map<?,?> properties, int defaultValue, java.lang.String... keys)Gets the specified configuration property.static intgetInteger(org.eclipse.aether.RepositorySystemSession session, int defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.util.List<?>getList(java.util.Map<?,?> properties, java.util.List<?> defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.util.List<?>getList(org.eclipse.aether.RepositorySystemSession session, java.util.List<?> defaultValue, java.lang.String... keys)Gets the specified configuration property.static longgetLong(java.util.Map<?,?> properties, long defaultValue, java.lang.String... keys)Gets the specified configuration property.static longgetLong(org.eclipse.aether.RepositorySystemSession session, long defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.util.Map<?,?>getMap(java.util.Map<?,?> properties, java.util.Map<?,?> defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.util.Map<?,?>getMap(org.eclipse.aether.RepositorySystemSession session, java.util.Map<?,?> defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.lang.ObjectgetObject(java.util.Map<?,?> properties, java.lang.Object defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.lang.ObjectgetObject(org.eclipse.aether.RepositorySystemSession session, java.lang.Object defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.lang.StringgetString(java.util.Map<?,?> properties, java.lang.String defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.lang.StringgetString(org.eclipse.aether.RepositorySystemSession session, java.lang.String defaultValue, java.lang.String... keys)Gets the specified configuration property.static java.util.List<java.lang.String>parseCommaSeparatedNames(java.lang.String commaSeparatedNames)Utility method to parse configuration string that contains comma separated list of names intoList<String>, never returnsnull.static java.util.List<java.lang.String>parseCommaSeparatedUniqueNames(java.lang.String commaSeparatedNames)Utility method to parse configuration string that contains comma separated list of names intoList<String>with unique elements (duplicates, if any, are discarded), never returnsnull.
-
-
-
Method Detail
-
getObject
public static java.lang.Object getObject(java.util.Map<?,?> properties, java.lang.Object defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys are set, may benullkeys- the property keys to read, must not benull. The specified keys are read one after one until a valid value is found.- Returns:
- the property value or
nullif none
-
getObject
public static java.lang.Object getObject(org.eclipse.aether.RepositorySystemSession session, java.lang.Object defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys are set, may benullkeys- the property keys to read, must not benull. The specified keys are read one after one until a valid value is found.- Returns:
- the property value or
nullif none
-
getString
public static java.lang.String getString(java.util.Map<?,?> properties, java.lang.String defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a string, may benullkeys- the property keys to read, must not benull. The specified keys are read one after one until a string value is found.- Returns:
- the property value or
nullif none
-
getString
public static java.lang.String getString(org.eclipse.aether.RepositorySystemSession session, java.lang.String defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a string, may benullkeys- the property keys to read, must not benull. The specified keys are read one after one until a string value is found.- Returns:
- the property value or
nullif none
-
getInteger
public static int getInteger(java.util.Map<?,?> properties, int defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a numberkeys- the property keys to read, must not benull. The specified keys are read one after one until aNumberor a string representation of anIntegeris found.- Returns:
- the property value
-
getInteger
public static int getInteger(org.eclipse.aether.RepositorySystemSession session, int defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a numberkeys- the property keys to read, must not benull. The specified keys are read one after one until aNumberor a string representation of anIntegeris found.- Returns:
- the property value
-
getLong
public static long getLong(java.util.Map<?,?> properties, long defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a numberkeys- the property keys to read, must not benull. The specified keys are read one after one until aNumberor a string representation of aLongis found.- Returns:
- the property value
-
getLong
public static long getLong(org.eclipse.aether.RepositorySystemSession session, long defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a numberkeys- the property keys to read, must not benull. The specified keys are read one after one until aNumberor a string representation of aLongis found.- Returns:
- the property value
-
getFloat
public static float getFloat(java.util.Map<?,?> properties, float defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a numberkeys- the property keys to read, must not benull. The specified keys are read one after one until aNumberor a string representation of aFloatis found.- Returns:
- the property value
-
getFloat
public static float getFloat(org.eclipse.aether.RepositorySystemSession session, float defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a numberkeys- the property keys to read, must not benull. The specified keys are read one after one until aNumberor a string representation of aFloatis found.- Returns:
- the property value
-
getBoolean
public static boolean getBoolean(java.util.Map<?,?> properties, boolean defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a booleankeys- the property keys to read, must not benull. The specified keys are read one after one until aBooleanor a string (to beparsed as boolean) is found.- Returns:
- the property value
-
getBoolean
public static boolean getBoolean(org.eclipse.aether.RepositorySystemSession session, boolean defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a booleankeys- the property keys to read, must not benull. The specified keys are read one after one until aBooleanor a string (to beparsed as boolean) is found.- Returns:
- the property value
-
getList
public static java.util.List<?> getList(java.util.Map<?,?> properties, java.util.List<?> defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a collectionkeys- the property keys to read, must not benull. The specified keys are read one after one until a collection is found.- Returns:
- the property value or
nullif none
-
getList
public static java.util.List<?> getList(org.eclipse.aether.RepositorySystemSession session, java.util.List<?> defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a collectionkeys- the property keys to read, must not benull. The specified keys are read one after one until a collection is found.- Returns:
- the property value or
nullif none
-
getMap
public static java.util.Map<?,?> getMap(java.util.Map<?,?> properties, java.util.Map<?,?> defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
properties- the configuration properties to read, must not benulldefaultValue- the default value to return in case none of the property keys is set to a mapkeys- the property keys to read, must not benull. The specified keys are read one after one until a map is found.- Returns:
- the property value or
nullif none
-
getMap
public static java.util.Map<?,?> getMap(org.eclipse.aether.RepositorySystemSession session, java.util.Map<?,?> defaultValue, java.lang.String... keys)
Gets the specified configuration property.- Parameters:
session- the repository system session from which to read the configuration property, must not benulldefaultValue- the default value to return in case none of the property keys is set to a mapkeys- the property keys to read, must not benull. The specified keys are read one after one until a map is found.- Returns:
- the property value or
nullif none
-
parseCommaSeparatedNames
public static java.util.List<java.lang.String> parseCommaSeparatedNames(java.lang.String commaSeparatedNames)
Utility method to parse configuration string that contains comma separated list of names intoList<String>, never returnsnull.- Since:
- 1.9.0
-
parseCommaSeparatedUniqueNames
public static java.util.List<java.lang.String> parseCommaSeparatedUniqueNames(java.lang.String commaSeparatedNames)
Utility method to parse configuration string that contains comma separated list of names intoList<String>with unique elements (duplicates, if any, are discarded), never returnsnull.- Since:
- 1.9.0
-
-