Package org.eclipse.aether.util
Class ConfigUtils
java.lang.Object
org.eclipse.aether.util.ConfigUtils
A utility class to read configuration properties from a repository system session.
- See Also:
-
RepositorySystemSession.getConfigProperties()
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetBoolean(Map<?, ?> properties, boolean defaultValue, String... keys) Gets the specified configuration property.static booleangetBoolean(org.eclipse.aether.RepositorySystemSession session, boolean defaultValue, String... keys) Gets the specified configuration property.static floatGets the specified configuration property.static floatGets the specified configuration property.static intgetInteger(Map<?, ?> properties, int defaultValue, String... keys) Gets the specified configuration property.static intgetInteger(org.eclipse.aether.RepositorySystemSession session, int defaultValue, String... keys) Gets the specified configuration property.static List<?>Gets the specified configuration property.static List<?>Gets the specified configuration property.static longGets the specified configuration property.static longGets the specified configuration property.static Map<?,?> Gets the specified configuration property.static Map<?,?> Gets the specified configuration property.static ObjectGets the specified configuration property.static ObjectGets the specified configuration property.static StringGets the specified configuration property.static StringGets the specified configuration property.parseCommaSeparatedNames(String commaSeparatedNames) parseCommaSeparatedUniqueNames(String commaSeparatedNames)
-
Method Details
-
getObject
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.defaultValue- The default value to return in case none of the property keys are set, may benull.keys- 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 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 benull.defaultValue- The default value to return in case none of the property keys are set, may benull.keys- 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
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.defaultValue- The default value to return in case none of the property keys is set to a string, may benull.keys- 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 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 benull.defaultValue- The default value to return in case none of the property keys is set to a string, may benull.keys- 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
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.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 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, String... keys) Gets the specified configuration property.- Parameters:
session- The repository system session from which to read the configuration property, must not benull.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 benull. The specified keys are read one after one until aNumberor a string representation of anIntegeris found.- Returns:
- The property value.
-
getLong
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.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 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, String... keys) Gets the specified configuration property.- Parameters:
session- The repository system session from which to read the configuration property, must not benull.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 benull. The specified keys are read one after one until aNumberor a string representation of aLongis found.- Returns:
- The property value.
-
getFloat
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.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 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, String... keys) Gets the specified configuration property.- Parameters:
session- The repository system session from which to read the configuration property, must not benull.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 benull. The specified keys are read one after one until aNumberor a string representation of aFloatis found.- Returns:
- The property value.
-
getBoolean
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.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 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, String... keys) Gets the specified configuration property.- Parameters:
session- The repository system session from which to read the configuration property, must not benull.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 benull. The specified keys are read one after one until aBooleanor a string (to beparsed as boolean) is found.- Returns:
- The property value.
-
getList
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.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 benull. The specified keys are read one after one until a collection is found.- Returns:
- The property value or
nullif 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 benull.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 benull. The specified keys are read one after one until a collection is found.- Returns:
- The property value or
nullif none.
-
getMap
Gets the specified configuration property.- Parameters:
properties- The configuration properties to read, must not benull.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 benull. The specified keys are read one after one until a map is found.- Returns:
- The property value or
nullif 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 benull.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 benull. The specified keys are read one after one until a map is found.- Returns:
- The property value or
nullif none.
-
parseCommaSeparatedNames
Utility method to parse configuration string that contains comma separated list of names intoList<String>, never returnsnull.- Since:
- 1.9.0
-
parseCommaSeparatedUniqueNames
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
-