Default Value

为选项设置默认值与 Optional Value 有些相关性,有些时候你可能需要了解用户是否定义了选项,并且根据默认值更改行为:

Having a default value for an option is somewhat related to Optional Value, as there are cases where you may want to know if the user defined an option and change behavior based on a default value:

  • Programmatic

  • Annotation

  • Legacy Annotation

Unresolved include directive in modules/ROOT/pages/options/default.adoc - include::../../../../src/test/java/org/springframework/shell/docs/OptionSnippets.java[]
Unresolved include directive in modules/ROOT/pages/options/default.adoc - include::../../../../src/test/java/org/springframework/shell/docs/OptionSnippets.java[]
Unresolved include directive in modules/ROOT/pages/options/default.adoc - include::../../../../src/test/java/org/springframework/shell/docs/OptionSnippets.java[]