| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_144) on Wed Dec 11 21:08:57 MST 2019 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>CommandLine.Option (Apache Log4j Core 2.13.0 API)</title> |
| <meta name="date" content="2019-12-11"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="CommandLine.Option (Apache Log4j Core 2.13.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/CommandLine.Option.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingTypeConverterException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.OverwrittenOptionException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../index.html?org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" target="_top">Frames</a></li> |
| <li><a href="CommandLine.Option.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Field | </li> |
| <li><a href="#annotation.type.required.element.summary">Required</a> | </li> |
| <li><a href="#annotation.type.optional.element.summary">Optional</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#annotation.type.element.detail">Element</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.logging.log4j.core.tools.picocli</div> |
| <h2 title="Annotation Type CommandLine.Option" class="title">Annotation Type CommandLine.Option</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Retention.html?is-external=true#value--" title="class or interface in java.lang.annotation">value</a>=<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</a>) |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Target.html?is-external=true#value--" title="class or interface in java.lang.annotation">value</a>=<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/ElementType.html?is-external=true#FIELD" title="class or interface in java.lang.annotation">FIELD</a>) |
| public static @interface <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.1105">CommandLine.Option</a></pre> |
| <div class="block"><p> |
| Annotate fields in your class with <code>@Option</code> and picocli will initialize these fields when matching |
| arguments are specified on the command line. |
| </p><p> |
| For example: |
| </p> |
| <pre>import static picocli.CommandLine.*; |
| |
| public class MyClass { |
| @Parameters(type = File.class, description = "Any number of input files") |
| private List<File> files = new ArrayList<File>(); |
| |
| @Option(names = { "-o", "--out" }, description = "Output file (default: print to console)") |
| private File outputFile; |
| |
| @Option(names = { "-v", "--verbose"}, description = "Verbosely list files processed") |
| private boolean verbose; |
| |
| @Option(names = { "-h", "--help", "-?", "-help"}, usageHelp = true, description = "Display this help and exit") |
| private boolean help; |
| |
| @Option(names = { "-V", "--version"}, versionHelp = true, description = "Display version information and exit") |
| private boolean version; |
| } |
| </pre> |
| <p> |
| A field cannot be annotated with both <code>@Parameters</code> and <code>@Option</code> or a |
| <code>ParameterException</code> is thrown. |
| </p></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation.type.required.element.summary"> |
| <!-- --> |
| </a> |
| <h3>Required Element Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Required Element Summary table, listing required elements, and an explanation"> |
| <caption><span>Required Elements</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Required Element and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#names--">names</a></span></code> |
| <div class="block">One or more option names.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation.type.optional.element.summary"> |
| <!-- --> |
| </a> |
| <h3>Optional Element Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation"> |
| <caption><span>Optional Elements</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Optional Element and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#arity--">arity</a></span></code> |
| <div class="block">Specifies the minimum number of required parameters and the maximum number of accepted parameters.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#description--">description</a></span></code> |
| <div class="block">Description of this option, used when generating the usage documentation.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#help--">help</a></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--"><code>usageHelp()</code></a> and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>versionHelp()</code></a> instead. See <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>CommandLine.printHelpIfRequested(List, PrintStream, CommandLine.Help.Ansi)</code></a></span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#hidden--">hidden</a></span></code> |
| <div class="block">Set <code>hidden=true</code> if this option should not be included in the usage documentation.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#paramLabel--">paramLabel</a></span></code> |
| <div class="block">Specify a <code>paramLabel</code> for the option parameter to be used in the usage help message.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#required--">required</a></span></code> |
| <div class="block">Indicates whether this option is required.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#split--">split</a></span></code> |
| <div class="block">Specify a regular expression to use to split option parameter values before applying them to the field.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?>[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#type--">type</a></span></code> |
| <div class="block"> |
| Optionally specify a <code>type</code> to control exactly what Class the option parameter should be converted |
| to.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--">usageHelp</a></span></code> |
| <div class="block">Set <code>usageHelp=true</code> if this option allows the user to request usage help.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--">versionHelp</a></span></code> |
| <div class="block">Set <code>versionHelp=true</code> if this option allows the user to request version information.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation.type.element.detail"> |
| <!-- --> |
| </a> |
| <h3>Element Detail</h3> |
| <a name="names--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>names</h4> |
| <pre>public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1148">names</a></pre> |
| <div class="block">One or more option names. At least one option name is required. |
| <p> |
| Different environments have different conventions for naming options, but usually options have a prefix |
| that sets them apart from parameters. |
| Picocli supports all of the below styles. The default separator is <code>'='</code>, but this can be configured. |
| </p><p> |
| <b>*nix</b> |
| </p><p> |
| In Unix and Linux, options have a short (single-character) name, a long name or both. |
| Short options |
| (<a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02">POSIX |
| style</a> are single-character and are preceded by the <code>'-'</code> character, e.g., <code>`-v'</code>. |
| <a href="https://www.gnu.org/software/tar/manual/html_node/Long-Options.html">GNU-style</a> long |
| (or <em>mnemonic</em>) options start with two dashes in a row, e.g., <code>`--file'</code>. |
| </p><p>Picocli supports the POSIX convention that short options can be grouped, with the last option |
| optionally taking a parameter, which may be attached to the option name or separated by a space or |
| a <code>'='</code> character. The below examples are all equivalent: |
| </p><pre> |
| -xvfFILE |
| -xvf FILE |
| -xvf=FILE |
| -xv --file FILE |
| -xv --file=FILE |
| -x -v --file FILE |
| -x -v --file=FILE |
| </pre><p> |
| <b>DOS</b> |
| </p><p> |
| DOS options mostly have upper case single-character names and start with a single slash <code>'/'</code> character. |
| Option parameters are separated by a <code>':'</code> character. Options cannot be grouped together but |
| must be specified separately. For example: |
| </p><pre> |
| DIR /S /A:D /T:C |
| </pre><p> |
| <b>PowerShell</b> |
| </p><p> |
| Windows PowerShell options generally are a word preceded by a single <code>'-'</code> character, e.g., <code>`-Help'</code>. |
| Option parameters are separated by a space or by a <code>':'</code> character. |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>one or more option names</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="required--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>required</h4> |
| <pre>public abstract boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1156">required</a></pre> |
| <div class="block">Indicates whether this option is required. By default this is false. |
| If an option is required, but a user invokes the program without specifying the required option, |
| a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.MissingParameterException</code></a> is thrown from the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>CommandLine.parse(String...)</code></a> method.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether this option is required</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="help--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>help</h4> |
| <pre>public abstract boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1174">help</a></pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--"><code>usageHelp()</code></a> and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>versionHelp()</code></a> instead. See <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>CommandLine.printHelpIfRequested(List, PrintStream, CommandLine.Help.Ansi)</code></a></span></div> |
| <div class="block">Set <code>help=true</code> if this option should disable validation of the remaining arguments: |
| If the <code>help</code> option is specified, no error message is generated for missing required options. |
| <p> |
| This attribute is useful for special options like help (<code>-h</code> and <code>--help</code> on unix, |
| <code>-?</code> and <code>-Help</code> on Windows) or version (<code>-V</code> and <code>--version</code> on unix, |
| <code>-Version</code> on Windows). |
| </p> |
| <p> |
| Note that the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>CommandLine.parse(String...)</code></a> method will not print help documentation. It will only set |
| the value of the annotated field. It is the responsibility of the caller to inspect the annotated fields |
| and take the appropriate action. |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether this option disables validation of the other arguments</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="usageHelp--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usageHelp</h4> |
| <pre>public abstract boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1192">usageHelp</a></pre> |
| <div class="block">Set <code>usageHelp=true</code> if this option allows the user to request usage help. If this option is |
| specified on the command line, picocli will not validate the remaining arguments (so no "missing required |
| option" errors) and the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isUsageHelpRequested--"><code>CommandLine.isUsageHelpRequested()</code></a> method will return <code>true</code>. |
| <p> |
| This attribute is useful for special options like help (<code>-h</code> and <code>--help</code> on unix, |
| <code>-?</code> and <code>-Help</code> on Windows). |
| </p> |
| <p> |
| Note that the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>CommandLine.parse(String...)</code></a> method will not print usage help documentation. It will only set |
| the value of the annotated field. It is the responsibility of the caller to inspect the annotated fields |
| and take the appropriate action. |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether this option allows the user to request usage help</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="versionHelp--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>versionHelp</h4> |
| <pre>public abstract boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1210">versionHelp</a></pre> |
| <div class="block">Set <code>versionHelp=true</code> if this option allows the user to request version information. If this option is |
| specified on the command line, picocli will not validate the remaining arguments (so no "missing required |
| option" errors) and the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isVersionHelpRequested--"><code>CommandLine.isVersionHelpRequested()</code></a> method will return <code>true</code>. |
| <p> |
| This attribute is useful for special options like version (<code>-V</code> and <code>--version</code> on unix, |
| <code>-Version</code> on Windows). |
| </p> |
| <p> |
| Note that the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>CommandLine.parse(String...)</code></a> method will not print version information. It will only set |
| the value of the annotated field. It is the responsibility of the caller to inspect the annotated fields |
| and take the appropriate action. |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether this option allows the user to request version information</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="description--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>description</h4> |
| <pre>public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1216">description</a></pre> |
| <div class="block">Description of this option, used when generating the usage documentation.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the description of this option</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>{}</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="arity--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>arity</h4> |
| <pre>public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1257">arity</a></pre> |
| <div class="block">Specifies the minimum number of required parameters and the maximum number of accepted parameters. |
| If an option declares a positive arity, and the user specifies an insufficient number of parameters on the |
| command line, a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.MissingParameterException</code></a> is thrown by the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>CommandLine.parse(String...)</code></a> method. |
| <p> |
| In many cases picocli can deduce the number of required parameters from the field's type. |
| By default, flags (boolean options) have arity zero, |
| and single-valued type fields (String, int, Integer, double, Double, File, Date, etc) have arity one. |
| Generally, fields with types that cannot hold multiple values can omit the <code>arity</code> attribute. |
| </p><p> |
| Fields used to capture options with arity two or higher should have a type that can hold multiple values, |
| like arrays or Collections. See <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#type--"><code>type()</code></a> for strongly-typed Collection fields. |
| </p><p> |
| For example, if an option has 2 required parameters and any number of optional parameters, |
| specify <code>@Option(names = "-example", arity = "2..*")</code>. |
| </p> |
| <b>A note on boolean options</b> |
| <p> |
| By default picocli does not expect boolean options (also called "flags" or "switches") to have a parameter. |
| You can make a boolean option take a required parameter by annotating your field with <code>arity="1"</code>. |
| For example: </p> |
| <pre>@Option(names = "-v", arity = "1") boolean verbose;</pre> |
| <p> |
| Because this boolean field is defined with arity 1, the user must specify either <code><program> -v false</code> |
| or <code><program> -v true</code> |
| on the command line, or a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.MissingParameterException</code></a> is thrown by the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>CommandLine.parse(String...)</code></a> |
| method. |
| </p><p> |
| To make the boolean parameter possible but optional, define the field with <code>arity = "0..1"</code>. |
| For example: </p> |
| <pre>@Option(names="-v", arity="0..1") boolean verbose;</pre> |
| <p>This will accept any of the below without throwing an exception:</p> |
| <pre> |
| -v |
| -v true |
| -v false |
| </pre></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>how many arguments this option requires</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>""</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="paramLabel--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>paramLabel</h4> |
| <pre>public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1275">paramLabel</a></pre> |
| <div class="block">Specify a <code>paramLabel</code> for the option parameter to be used in the usage help message. If omitted, |
| picocli uses the field name in fish brackets (<code>'<'</code> and <code>'>'</code>) by default. Example: |
| <pre>class Example { |
| @Option(names = {"-o", "--output"}, paramLabel="FILE", description="path of the output file") |
| private File out; |
| @Option(names = {"-j", "--jobs"}, arity="0..1", description="Allow N jobs at once; infinite jobs with no arg.") |
| private int maxJobs = -1; |
| }</pre> |
| <p>By default, the above gives a usage help message like the following:</p><pre> |
| Usage: <main class> [OPTIONS] |
| -o, --output FILE path of the output file |
| -j, --jobs [<maxJobs>] Allow N jobs at once; infinite jobs with no arg. |
| </pre></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>name of the option parameter used in the usage help message</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>""</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="type--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>type</h4> |
| <pre>public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?>[] <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1304">type</a></pre> |
| <div class="block"><p> |
| Optionally specify a <code>type</code> to control exactly what Class the option parameter should be converted |
| to. This may be useful when the field type is an interface or an abstract class. For example, a field can |
| be declared to have type <code>java.lang.Number</code>, and annotating <code>@Option(type=Short.class)</code> |
| ensures that the option parameter value is converted to a <code>Short</code> before setting the field value. |
| </p><p> |
| For array fields whose <em>component</em> type is an interface or abstract class, specify the concrete <em>component</em> type. |
| For example, a field with type <code>Number[]</code> may be annotated with <code>@Option(type=Short.class)</code> |
| to ensure that option parameter values are converted to <code>Short</code> before adding an element to the array. |
| </p><p> |
| Picocli will use the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="interface in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.ITypeConverter</code></a> that is |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#registerConverter-java.lang.Class-org.apache.logging.log4j.core.tools.picocli.CommandLine.ITypeConverter-">registered</a> for the specified type to convert |
| the raw String values before modifying the field value. |
| </p><p> |
| Prior to 2.0, the <code>type</code> attribute was necessary for <code>Collection</code> and <code>Map</code> fields, |
| but starting from 2.0 picocli will infer the component type from the generic type's type arguments. |
| For example, for a field of type <code>Map<TimeUnit, Long></code> picocli will know the option parameter |
| should be split up in key=value pairs, where the key should be converted to a <code>java.util.concurrent.TimeUnit</code> |
| enum value, and the value should be converted to a <code>Long</code>. No <code>@Option(type=...)</code> type attribute |
| is required for this. For generic types with wildcards, picocli will take the specified upper or lower bound |
| as the Class to convert to, unless the <code>@Option</code> annotation specifies an explicit <code>type</code> attribute. |
| </p><p> |
| If the field type is a raw collection or a raw map, and you want it to contain other values than Strings, |
| or if the generic type's type arguments are interfaces or abstract classes, you may |
| specify a <code>type</code> attribute to control the Class that the option parameter should be converted to.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the type(s) to convert the raw String values</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>{}</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="split--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>split</h4> |
| <pre>public abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1312">split</a></pre> |
| <div class="block">Specify a regular expression to use to split option parameter values before applying them to the field. |
| All elements resulting from the split are added to the array or Collection. Ignored for single-value fields.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a regular expression to split option parameter values or <code>""</code> if the value should not be split</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true#split-java.lang.String-" title="class or interface in java.lang"><code>String.split(String)</code></a></dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>""</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="hidden--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>hidden</h4> |
| <pre>public abstract boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#line.1318">hidden</a></pre> |
| <div class="block">Set <code>hidden=true</code> if this option should not be included in the usage documentation.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether this option should be excluded from the usage message</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/CommandLine.Option.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingTypeConverterException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.OverwrittenOptionException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../index.html?org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" target="_top">Frames</a></li> |
| <li><a href="CommandLine.Option.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Field | </li> |
| <li><a href="#annotation.type.required.element.summary">Required</a> | </li> |
| <li><a href="#annotation.type.optional.element.summary">Optional</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#annotation.type.element.detail">Element</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small><p align="center">Copyright © 1999-2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.<br /> Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.</p></small></p> |
| </body> |
| </html> |