Package org.springframework.boot
Class DefaultApplicationArguments
java.lang.Object
org.springframework.boot.DefaultApplicationArguments
- All Implemented Interfaces:
ApplicationArguments
Default implementation of
ApplicationArguments.- Since:
- 1.4.1
- Author:
- Phillip Webb
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsOption(String name) Return whether the set of option arguments parsed from the arguments contains an option with the given name.Return the collection of non-option arguments parsed.Return the names of all option arguments.getOptionValues(String name) Return the collection of values associated with the arguments option having the given name.String[]Return the raw unprocessed arguments that were passed to the application.
-
Constructor Details
-
DefaultApplicationArguments
-
-
Method Details
-
getSourceArgs
Description copied from interface:ApplicationArgumentsReturn the raw unprocessed arguments that were passed to the application.- Specified by:
getSourceArgsin interfaceApplicationArguments- Returns:
- the arguments
-
getOptionNames
Description copied from interface:ApplicationArgumentsReturn the names of all option arguments. For example, if the arguments were "--foo=bar --debug" would return the values["foo", "debug"].- Specified by:
getOptionNamesin interfaceApplicationArguments- Returns:
- the option names or an empty set
-
containsOption
Description copied from interface:ApplicationArgumentsReturn whether the set of option arguments parsed from the arguments contains an option with the given name.- Specified by:
containsOptionin interfaceApplicationArguments- Parameters:
name- the name to check- Returns:
trueif the arguments contain an option with the given name
-
getOptionValues
Description copied from interface:ApplicationArgumentsReturn the collection of values associated with the arguments option having the given name.- if the option is present and has no argument (e.g.: "--foo"), return an empty
collection (
[]) - if the option is present and has a single value (e.g. "--foo=bar"), return a
collection having one element (
["bar"]) - if the option is present and has multiple values (e.g. "--foo=bar --foo=baz"),
return a collection having elements for each value (
["bar", "baz"]) - if the option is not present, return
null
- Specified by:
getOptionValuesin interfaceApplicationArguments- Parameters:
name- the name of the option- Returns:
- a list of option values for the given name
- if the option is present and has no argument (e.g.: "--foo"), return an empty
collection (
-
getNonOptionArgs
Description copied from interface:ApplicationArgumentsReturn the collection of non-option arguments parsed.- Specified by:
getNonOptionArgsin interfaceApplicationArguments- Returns:
- the non-option arguments or an empty list
-