Top Description Fields Constructors Methods
org.springframework.core.env

pack-priv Class CommandLineArgs

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Set, org.springframework.lang.Nullable

A simple representation of command line arguments, broken into "option arguments" and "non-option arguments".
Author
Chris Beams
Since
3.1
See Also
SimpleCommandLineArgsParser

Field Summary

Modifier and TypeField and Description
private final List<String>
private final Map<String, List<String>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addNonOptionArg(String value)

Add the given value to the list of non-option arguments.

public void
addOptionArg(String optionName, String optionValue)

Add an option argument for the given option name and add the given value to the list of values associated with this option (of which there may be zero or more).

public boolean
containsOption(String optionName)

Return whether the option with the given name was present on the command line.

public List<String>
getNonOptionArgs()

Return the list of non-option arguments specified on the command line.

public Set<String>
getOptionNames()

Return the set of all option arguments present on the command line.

public List<String>
getOptionValues(String optionName)

Return the list of values associated with the given option.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nonOptionArgsback to summary
private final List<String> nonOptionArgs
optionArgsback to summary
private final Map<String, List<String>> optionArgs

Constructor Detail

CommandLineArgsback to summary
pack-priv CommandLineArgs()

Method Detail

addNonOptionArgback to summary
public void addNonOptionArg(String value)

Add the given value to the list of non-option arguments.

addOptionArgback to summary
public void addOptionArg(String optionName, String optionValue)

Add an option argument for the given option name and add the given value to the list of values associated with this option (of which there may be zero or more). The given value may be null, indicating that the option was specified without an associated value (e.g. "--foo" vs. "--foo=bar").

containsOptionback to summary
public boolean containsOption(String optionName)

Return whether the option with the given name was present on the command line.

getNonOptionArgsback to summary
public List<String> getNonOptionArgs()

Return the list of non-option arguments specified on the command line.

getOptionNamesback to summary
public Set<String> getOptionNames()

Return the set of all option arguments present on the command line.

getOptionValuesback to summary
public List<String> getOptionValues(String optionName)

Return the list of values associated with the given option. null signifies that the option was not present; empty list signifies that no values were associated with this option.

Annotations
@Nullable