24 lines
601 B
Plaintext
24 lines
601 B
Plaintext
[[using-shell-options-optional]]
|
|
=== Optional Value
|
|
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
|
|
|
|
An option is either required or not and, generally speaking, how it behaves depends on
|
|
a command target:
|
|
|
|
====
|
|
[source, java, indent=0]
|
|
----
|
|
include::{snippets}/OptionSnippets.java[tag=option-registration-optional]
|
|
----
|
|
====
|
|
|
|
In the annotation model, there is no direct way to define if argument is
|
|
optional. Instead, it is instructed to be `NULL`:
|
|
|
|
====
|
|
[source, java, indent=0]
|
|
----
|
|
include::{snippets}/OptionSnippets.java[tag=option-with-annotation-optional]
|
|
----
|
|
====
|