Package org.omegazero.common.util
Class Args.DefaultFormat
java.lang.Object
org.omegazero.common.util.Args
org.omegazero.common.util.Args.DefaultFormat
- All Implemented Interfaces:
Serializable
- Enclosing class:
- Args
An
Args
implementation for the default argument format.- Since:
- 2.8
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.omegazero.common.util.Args
Args.DefaultFormat
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
parseArguments
(String[] args) Parses the given argument array and stores the data in thisArgs
object.Methods inherited from class org.omegazero.common.util.Args
getBooleanOrDefault, getDoubleOrDefault, getFloatOrDefault, getIntOrDefault, getLongOrDefault, getValue, getValueOrDefault, parse, put
-
Constructor Details
-
DefaultFormat
public DefaultFormat()
-
-
Method Details
-
parseArguments
Parses the given argument array and stores the data in thisArgs
object.Values identified as integers, booleans ("
true
" and "false
") or floating-point numbers are automatically converted to the respective type.Arguments are parsed as key-value pairs. A key-value pair consists of a pair of elements in the given array: the first element is
--
followed by the key string, the second element is the value string. For example:--exampleKey value
The key is "exampleKey
" and the value is "value
". If a key string such as "--key
" has no value (at the end of the array), it is ignored.To set a key (for example "
key
") to the boolean valuetrue
, the shorthand "-key
" (single dash) may be used.- Specified by:
parseArguments
in classArgs
- Parameters:
args
- The argument array
-