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>
This commit is contained in:
puppy4c
2025-01-18 10:53:24 +08:00
committed by Sam Brannen
parent 4783c321d9
commit c463b937b8
2 changed files with 10 additions and 8 deletions

View File

@@ -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;
* --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

View File

@@ -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;
* --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