summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorCedric Beust <cedric@beust.com>2012-07-31 13:49:28 -0700
committerCedric Beust <cedric@beust.com>2012-07-31 13:49:28 -0700
commit3d5343bd6a916feca9bfcfdf5fac9450b2f5fe1c (patch)
tree807441de7c12241efe31ac807f9eb1cf4b83a3c3 /doc
parenta8f4de2555e41fad6cab4fbcff4e91cc32350db7 (diff)
downloadplatform_external_jcommander-3d5343bd6a916feca9bfcfdf5fac9450b2f5fe1c.tar.gz
platform_external_jcommander-3d5343bd6a916feca9bfcfdf5fac9450b2f5fe1c.tar.bz2
platform_external_jcommander-3d5343bd6a916feca9bfcfdf5fac9450b2f5fe1c.zip
Doc update.
Diffstat (limited to 'doc')
-rw-r--r--doc/index.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/index.html b/doc/index.html
index aabfa53..b61ad0c 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -100,6 +100,22 @@ private boolean debug = false;
Such a parameter does not require any additional parameter on the command line and if it's detected during parsing, the corresponding field will be set to <tt>true</tt>.
+<p>
+
+ If you want to define a boolean parameter that's <tt>true</tt> by default, you can declare it as having an arity of 1. Users will then have to specify the value they want explicitly:
+
+ <pre class="brush: java">
+ @Parameter(names = "-debug", description = "Debug mode", arity = 1)
+ private boolean debug = true;
+ </pre>
+
+ Invoke with either of:
+
+ <pre class="brush: plain">
+ program -debug true
+ program -debug false
+ </pre>
+
<h4>String, Integer, Long</h4>
When a <tt>Parameter</tt> annotation is found on a field of type <tt>String</tt>, <tt>Integer</tt>, <tt>int</tt>, <tt>Long</tt> or <tt>long</tt>, JCommander will parse the following parameter and it will attempt to cast it to the right type: