Package berlin.yuna.clu.logic
Class ArgumentReader
- All Implemented Interfaces:
Serializable,ConcurrentMap<String,,List<String>> Map<String,List<String>>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap
ConcurrentHashMap.KeySetView<K extends Object,V extends Object> Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArgumentReader(boolean parseEnv, String... args) Parses a string arguments into key value -
Method Summary
Modifier and TypeMethodDescriptionprotected ArgumentReaderaddCommands(String[] cmdList) protected ArgumentReaderbooleangetgetbooleangetBoolean(int index, String... keys) getBooleanbooleangetBoolean(String... keys) getBooleanbooleangetBoolean(String separator, int index, String... keys) getBooleangetBooleans(String... keys) getBooleangetBooleans(String separator, String[] keys) getBooleanget commandgetCommand(int index) get commandget commandsgetDoublegetDoublegetDoublegetDoubles(char separator, String... keys) getDoublesgetDoubles(String... keys) getDoublesgetDoubles(String separator, String[] keys) getDoublesgetLonggetLonggetLongsgetLongsgetLongsgetStringgetStringgetStringgetStrings(char separator, String... keys) getStringsgetStrings(String... keys) getStringsgetStrings(String separator, String[] keys) getStringsprotected StringgetStripedValue(String value) protected StringgetValuebooleanhasCommand(String command) has commandinthashCode()booleanisPresentstatic ArgumentReaderParses a string arguments into key values
example: [mvn clean install --Dencoding="UTF-8", --javaVersion 8 -v=true --args=1,2,3]
example (commands): [mvn, clean, install]
example (kv): [Dencoding=UTF-8, javaVersion=8, v=true, args=1,2,3]
See:
getString(String, int, String...)
getLong(String, int, String...)
getDouble(String, int, String...)
getValue(String, int, String...)
get(String, String)
getCommands()
hasCommand(String)static ArgumentReaderParses a string arguments into key values
example: [mvn clean install --Dencoding="UTF-8", --javaVersion 8 -v=true --args=1,2,3]
example (commands): [mvn, clean, install]
example (kv): [Dencoding=UTF-8, javaVersion=8, v=true, args=1,2,3]
See:
getString(String, int, String...)
getLong(String, int, String...)
getDouble(String, int, String...)
getValue(String, int, String...)
get(String, String)
getCommands()
hasCommand(String)protected ArgumentReaderparseCommandLine(String input) protected StringparseCommands(String input) protected String[]parseToKeyValue(String argument) removeDuplicates(List<String> result) toDouble()toLong()Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, valuesMethods inherited from class java.util.AbstractMap
clone
-
Field Details
-
commandList
-
-
Constructor Details
-
ArgumentReader
Parses a string arguments into key value- Parameters:
args- strings with arguments
-
-
Method Details
-
parseArgs
Parses a string arguments into key values
example: [mvn clean install --Dencoding="UTF-8", --javaVersion 8 -v=true --args=1,2,3]
example (commands): [mvn, clean, install]
example (kv): [Dencoding=UTF-8, javaVersion=8, v=true, args=1,2,3]
See:
getString(String, int, String...)
getLong(String, int, String...)
getDouble(String, int, String...)
getValue(String, int, String...)
get(String, String)
getCommands()
hasCommand(String)- Parameters:
args- strings with arguments
-
parseArgs
Parses a string arguments into key values
example: [mvn clean install --Dencoding="UTF-8", --javaVersion 8 -v=true --args=1,2,3]
example (commands): [mvn, clean, install]
example (kv): [Dencoding=UTF-8, javaVersion=8, v=true, args=1,2,3]
See:
getString(String, int, String...)
getLong(String, int, String...)
getDouble(String, int, String...)
getValue(String, int, String...)
get(String, String)
getCommands()
hasCommand(String)- Parameters:
args- strings with argumentsparseEnv- if true, will also parse environment variables
-
getCommand
get command- Returns:
- command
-
getCommand
get command- Parameters:
index- number of command- Returns:
- command or null if no command were found
-
getCommands
get commands- Returns:
- all commands
-
hasCommand
has command- Returns:
- true if command exists
-
isPresent
isPresent- Parameters:
keys- search for- Returns:
- true if one key is present
-
getString
getString- Parameters:
keys- search for- Returns:
- returns
Optionalvalue orOptional.empty()if no value is present
-
getString
getString- Parameters:
keys- search forindex- number of value- Returns:
- returns
Optionalvalue orOptional.empty()if no value is present
-
getString
getString- Parameters:
keys- search forindex- number of valueseparator- handles values as list if present- Returns:
- returns
Optionalvalue orOptional.empty()if no value is present
-
getStrings
getStrings- Parameters:
keys- search for- Returns:
- returns values or empty list if no value is present
-
getStrings
getStrings- Parameters:
keys- search forseparator- handles values as list if present- Returns:
- returns values or empty list if no value is present
-
getStrings
getStrings- Parameters:
keys- search forseparator- handles values as list if present- Returns:
- returns values or empty list if no value is present
-
getBoolean
getBoolean- Parameters:
keys- search for- Returns:
- true if [value == 1], [value == true], [key != && value == null]
-
getBoolean
getBoolean- Parameters:
keys- search forindex- number of value- Returns:
- true if [value == 1], [value == true], [key != && value == null]
-
getBoolean
getBoolean- Parameters:
keys- search forindex- number of valueseparator- handles values as list if present- Returns:
- true if [value == 1], [value == true], [key != && value == null]
-
getBooleans
getBoolean- Parameters:
keys- search for- Returns:
- boolean list if [value == 1], [value == true]
-
getBooleans
getBoolean- Parameters:
keys- search forseparator- handles values as list if present- Returns:
- boolean list if [value == 1], [value == true]
-
getLong
-
getLong
getLong -
getLong
getLong -
getLongs
getLongs -
getLongs
getLongs -
getLongs
getLongs -
getDouble
getDouble -
getDouble
getDouble -
getDouble
getDouble -
getDoubles
getDoubles -
getDoubles
getDoubles -
getDoubles
getDoubles -
get
get- Parameters:
key- search for- Returns:
- list of values or empty list if not found
-
get
get- Parameters:
key- search forseparator- handles values as list if present- Returns:
- list of values or empty list if not found
-
removeDuplicates
-
parseEnvironment
-
parseCommandLine
-
addKV
-
parseCommands
-
addCommands
-
getStripedValue
-
parseToKeyValue
-
getValues
-
getValue
getValue- Parameters:
keys- search forindex- number of valueseparator- handles values as list if present- Returns:
- value or null if no value was found
-
toBoolean
-
toLong
-
toDouble
-
equals
-
hashCode
public int hashCode()
-