接口 ApplicationArguments
- 所有已知实现类:
DefaultApplicationArguments
public interface ApplicationArguments
Provides access to the arguments that were used to run a
SpringApplication
.- 从以下版本开始:
- 1.3.0
- 作者:
- Phillip Webb
-
方法概要
修饰符和类型方法说明boolean
containsOption
(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.
-
方法详细资料
-
getSourceArgs
String[] getSourceArgs()Return the raw unprocessed arguments that were passed to the application.- 返回:
- the arguments
-
getOptionNames
Return the names of all option arguments. For example, if the arguments were "--foo=bar --debug" would return the values["foo", "debug"]
.- 返回:
- the option names or an empty set
-
containsOption
Return whether the set of option arguments parsed from the arguments contains an option with the given name.- 参数:
name
- the name to check- 返回:
true
if the arguments contain an option with the given name
-
getOptionValues
Return 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
- 参数:
name
- the name of the option- 返回:
- 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
Return the collection of non-option arguments parsed.- 返回:
- the non-option arguments or an empty list
-