Fix documentation

- Optional Parameters and Default Values. Type error in greet method signature who cause compile error
 - Customizing the Named Parameter Key(s). help method is already registered in spring shell by default and cannot be reused
This commit is contained in:
altus34
2017-09-22 12:00:03 -04:00
committed by Eric Bottard
parent a50b741af1
commit 1695527408

View File

@@ -235,11 +235,12 @@ For such a setup, the possible parameter keys will be `-a`, `-b` and `--third`.
[TIP]
====
It is possible to specify several keys for a single parameter. If so, these will be mutually exclusive ways
to specify the same parameter (so only one of them can be used). Here is an example:
to specify the same parameter (so only one of them can be used). As an example, here is the signature of the
built-in xref:help-command[`help`] command:
[source, java]
----
@ShellMethod("Describe a command.")
public String help(@ShellOption({"-C", "--command"} String command) {
public String help(@ShellOption({"-C", "--command"}) String command) {
...
}
----
@@ -252,7 +253,7 @@ those parameters:
[source, java]
----
@ShellMethod("Say hello.")
public String greet(@ShellOption(defaultValue="World"} String who) {
public String greet(@ShellOption(defaultValue="World") String who) {
return "Hello " + who;
}
----
@@ -588,8 +589,6 @@ wildcard that matches all command names. It's thus easy to turn all commands of
with a single availability method.
====
[TIP]
====
Spring Shell does not impose much constraints on how to write commands and how to organize classes.