public class ArgumentReader extends ConcurrentHashMap<String,List<String>>
ConcurrentHashMap.KeySetView<K,V>AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
commandList |
| Modifier | Constructor and Description |
|---|---|
protected |
ArgumentReader(boolean parseEnv,
String... args)
Parses a string arguments into key value
|
| Modifier and Type | Method and Description |
|---|---|
protected ArgumentReader |
addCommands(String[] cmdList) |
protected ArgumentReader |
addKV(String key,
String value) |
boolean |
equals(Object o) |
List<String> |
get(String key)
get
|
List<String> |
get(String separator,
String key)
get
|
boolean |
getBoolean(int index,
String... keys)
getBoolean
|
boolean |
getBoolean(String... keys)
getBoolean
|
boolean |
getBoolean(String separator,
int index,
String... keys)
getBoolean
|
List<Boolean> |
getBooleans(String... keys)
getBoolean
|
List<Boolean> |
getBooleans(String separator,
String[] keys)
getBoolean
|
String |
getCommand()
get command
|
String |
getCommand(int index)
get command
|
List<String> |
getCommands()
get commands
|
Optional<Double> |
getDouble(int index,
String... keys)
getDouble
|
Optional<Double> |
getDouble(String... keys)
getDouble
|
Optional<Double> |
getDouble(String separator,
int index,
String... keys)
getDouble
|
List<Double> |
getDoubles(char separator,
String... keys)
getDoubles
|
List<Double> |
getDoubles(String... keys)
getDoubles
|
List<Double> |
getDoubles(String separator,
String[] keys)
getDoubles
|
Optional<Long> |
getLong(int index,
String... keys)
getLong
|
Optional<Long> |
getLong(String... keys) |
Optional<Long> |
getLong(String separator,
int index,
String... keys)
getLong
|
List<Long> |
getLongs(char separator,
String... keys)
getLongs
|
List<Long> |
getLongs(String... keys)
getLongs
|
List<Long> |
getLongs(String separator,
String[] keys)
getLongs
|
Optional<String> |
getString(int index,
String... keys)
getString
|
Optional<String> |
getString(String... keys)
getString
|
Optional<String> |
getString(String separator,
int index,
String... keys)
getString
|
List<String> |
getStrings(char separator,
String... keys)
getStrings
|
List<String> |
getStrings(String... keys)
getStrings
|
List<String> |
getStrings(String separator,
String[] keys)
getStrings
|
protected String |
getStripedValue(String value) |
protected String |
getValue(String separator,
int index,
String... keys)
getValue
|
protected List<String> |
getValues(String separator,
String[] keys) |
boolean |
hasCommand(String command)
has command
|
int |
hashCode() |
boolean |
isPresent(String... keys)
isPresent
|
static ArgumentReader |
parseArgs(boolean parseEnv,
String... args)
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) |
static ArgumentReader |
parseArgs(String... args)
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) |
protected ArgumentReader |
parseCommandLine(String input) |
protected String |
parseCommands(String input) |
ArgumentReader |
parseEnvironment() |
protected String[] |
parseToKeyValue(String argument) |
protected List<String> |
removeDuplicates(List<String> result) |
protected Function<String,Boolean> |
toBoolean() |
protected Function<String,Double> |
toDouble() |
protected Function<String,Long> |
toLong() |
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, valuescloneprotected ArgumentReader(boolean parseEnv,
String... args)
args - strings with argumentspublic static ArgumentReader parseArgs(String... args)
getString(String, int, String...) getLong(String, int, String...) getDouble(String, int, String...) getValue(String, int, String...) get(String, String) getCommands() hasCommand(String) args - strings with argumentspublic static ArgumentReader parseArgs(boolean parseEnv, String... args)
getString(String, int, String...) getLong(String, int, String...) getDouble(String, int, String...) getValue(String, int, String...) get(String, String) getCommands() hasCommand(String) args - strings with argumentsparseEnv - if true, will also parse environment variablespublic String getCommand()
public String getCommand(int index)
index - number of commandpublic boolean hasCommand(String command)
public boolean isPresent(String... keys)
keys - search forpublic Optional<String> getString(String... keys)
keys - search forOptional value or Optional.empty() if no value is presentpublic Optional<String> getString(int index, String... keys)
keys - search forindex - number of valueOptional value or Optional.empty() if no value is presentpublic Optional<String> getString(String separator, int index, String... keys)
keys - search forindex - number of valueseparator - handles values as list if presentOptional value or Optional.empty() if no value is presentpublic List<String> getStrings(String... keys)
keys - search forpublic List<String> getStrings(char separator, String... keys)
keys - search forseparator - handles values as list if presentpublic List<String> getStrings(String separator, String[] keys)
keys - search forseparator - handles values as list if presentpublic boolean getBoolean(String... keys)
keys - search forpublic boolean getBoolean(int index,
String... keys)
keys - search forindex - number of valuepublic boolean getBoolean(String separator, int index, String... keys)
keys - search forindex - number of valueseparator - handles values as list if presentpublic List<Boolean> getBooleans(String... keys)
keys - search forpublic List<Boolean> getBooleans(String separator, String[] keys)
keys - search forseparator - handles values as list if presentpublic List<String> get(String key)
key - search forpublic List<String> get(String separator, String key)
key - search forseparator - handles values as list if presentpublic ArgumentReader parseEnvironment()
protected ArgumentReader parseCommandLine(String input)
protected ArgumentReader addKV(String key, String value)
protected ArgumentReader addCommands(String[] cmdList)
protected String getValue(String separator, int index, String... keys)
keys - search forindex - number of valueseparator - handles values as list if presentpublic boolean equals(Object o)
Copyright © 2022. All rights reserved.