Class Arguments
java.lang.Object
org.refcodes.runtime.Arguments
This utility class provides method useful for working with command line
arguments (as of
public static void main(String[] args) ).-
Method Summary
Modifier and TypeMethodDescriptiontoProperties(String[] aArgs) Creates aMapfrom the provided command line arguments using theArgsPrefix.toPrefixes()prefixes to identify the keys (and the values) from the provided arguments.toProperties(String[] aArgs, String[] aPrefixes, char aDelimiter) Creates aMapfrom the provided command line arguments using the provided prefixes to identify the keys (and the values) from the provided arguments.toProperties(String[] aArgs, Collection<String> aPrefixes, char aDelimiter) Creates aMapfrom the provided command line arguments using the provided prefixes to identify the keys (and the values) from the provided arguments.
-
Method Details
-
toProperties
Creates aMapfrom the provided command line arguments using theArgsPrefix.toPrefixes()prefixes to identify the keys (and the values) from the provided arguments.- Parameters:
aArgs- The command line arguments to convert to properties.- Returns:
- The
Mapcontaining the determined properties.
-
toProperties
public static Map<String,String> toProperties(String[] aArgs, Collection<String> aPrefixes, char aDelimiter) Creates aMapfrom the provided command line arguments using the provided prefixes to identify the keys (and the values) from the provided arguments.- Parameters:
aArgs- The command line arguments to convert to properties.aPrefixes- The prefixes to be used to identify options.aDelimiter- The delimiter to use when generating non colliding keys.- Returns:
- The
Mapcontaining the determined properties.
-
toProperties
Creates aMapfrom the provided command line arguments using the provided prefixes to identify the keys (and the values) from the provided arguments.- Parameters:
aArgs- The command line arguments to convert to properties.aPrefixes- The prefixes to be used to identify options.aDelimiter- The delimiter to use when generating non colliding keys.- Returns:
- The
Mapcontaining the determined properties.
-