Browse Source

Update Javadoc for SimpleCommandLinePropertySource

For ComandLineArgs, supplying the same option multiple times with
different values is valid, and the values will be stored in a List.

This commit also updates the Javadoc for SimpleCommandLineArgsParser.

See gh-34282

Signed-off-by: puppy4c <puppy4c@foxmail.com>
pull/34362/head
puppy4c 1 year ago committed by Sam Brannen
parent
commit
c463b937b8
  1. 9
      spring-core/src/main/java/org/springframework/core/env/SimpleCommandLineArgsParser.java
  2. 9
      spring-core/src/main/java/org/springframework/core/env/SimpleCommandLinePropertySource.java

9
spring-core/src/main/java/org/springframework/core/env/SimpleCommandLineArgsParser.java vendored

@ -28,7 +28,8 @@ package org.springframework.core.env; @@ -28,7 +28,8 @@ package org.springframework.core.env;
* <p>That is, options must be prefixed with "{@code --}" and may or may not
* specify a value. If a value is specified, the name and value must be separated
* <em>without spaces</em> by an equals sign ("="). The value may optionally be
* an empty string.
* an empty string. if the option is present and has multiple values (e. g. "--foo=bar --foo=baz"),
* the values are parsed as a collection.
*
* <h4>Valid examples of option arguments</h4>
* <pre class="code">
@ -37,14 +38,14 @@ package org.springframework.core.env; @@ -37,14 +38,14 @@ package org.springframework.core.env;
* --foo=""
* --foo=bar
* --foo="bar then baz"
* --foo=bar,baz,biz</pre>
* --foo=bar,baz,biz
* --foo=bar --foo=baz --foo=biz</pre>
*
* <h4>Invalid examples of option arguments</h4>
* <pre class="code">
* -foo
* --foo bar
* --foo = bar
* --foo=bar --foo=baz --foo=biz</pre>
* --foo = bar</pre>
*
* <h3>End of option arguments</h3>
* <p>This parser supports the POSIX "end of options" delimiter, meaning that any

9
spring-core/src/main/java/org/springframework/core/env/SimpleCommandLinePropertySource.java vendored

@ -40,7 +40,8 @@ import org.springframework.util.StringUtils; @@ -40,7 +40,8 @@ import org.springframework.util.StringUtils;
* <p>That is, options must be prefixed with "{@code --}" and may or may not
* specify a value. If a value is specified, the name and value must be separated
* <em>without spaces</em> by an equals sign ("="). The value may optionally be
* an empty string.
* an empty string. if the option is present and has multiple values (e. g. "--foo=bar --foo=baz"),
* the values are parsed as a collection.
*
* <h4>Valid examples of option arguments</h4>
* <pre class="code">
@ -49,14 +50,14 @@ import org.springframework.util.StringUtils; @@ -49,14 +50,14 @@ import org.springframework.util.StringUtils;
* --foo=""
* --foo=bar
* --foo="bar then baz"
* --foo=bar,baz,biz</pre>
* --foo=bar,baz,biz
* --foo=bar --foo=baz --foo=biz</pre>
*
* <h4>Invalid examples of option arguments</h4>
* <pre class="code">
* -foo
* --foo bar
* --foo = bar
* --foo=bar --foo=baz --foo=biz</pre>
* --foo = bar</pre>
*
* <h3>End of option arguments</h3>
* <p>The underlying parser supports the POSIX "end of options" delimiter, meaning

Loading…
Cancel
Save