blob: 60145ab0f2eb0bef13bf2e031dec10e03df5b838 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="it">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Thu Jun 14 10:04:10 CEST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CommandProcessor (OpenJPA Parent POM 2.4.3 API)</title>
<meta name="date" content="2018-06-14">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CommandProcessor (OpenJPA Parent POM 2.4.3 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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/CommandProcessor.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>Prev Class</li>
<li><a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?openbook/tools/CommandProcessor.html" target="_top">Frames</a></li>
<li><a href="CommandProcessor.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:&nbsp;</li>
<li><a href="#nested_class_summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</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">openbook.tools</div>
<h2 title="Class CommandProcessor" class="title">Class CommandProcessor</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>openbook.tools.CommandProcessor</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">CommandProcessor</span>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Processes options.
<br>
User can register a set of command options. Then this processor will parse a set of Strings to
store the values for each of the registered options as well as optionally any unrecognized
option values.</div>
<dl><dt><span class="strong">Author:</span></dt>
<dd>Pinaki Poddar</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a></strong></code>
<div class="block">A simple immutable object represents meta-data about a command option.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../openbook/tools/CommandProcessor.html#CommandProcessor()">CommandProcessor</a></strong>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a></code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#findCommand(java.lang.String)">findCommand</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;option)</code>
<div class="block">Finds a command with the given name.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#getAllowsUnregisteredOption()">getAllowsUnregisteredOption</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;<a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#getUnregisteredCommands()">getUnregisteredCommands</a></strong>()</code>
<div class="block">Gets all the unrecognized command options.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#getValue(java.lang.String)">getValue</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;alias)</code>
<div class="block">Gets value of the option matching the given alias.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#lastIndex(java.lang.String[])">lastIndex</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;args)</code>
<div class="block">Gets the last index in the given array that can be processed as an option.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a></code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#register(boolean,%20java.lang.String...)">register</a></strong>(boolean&nbsp;requiresValue,
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>...&nbsp;aliases)</code>
<div class="block">Register the given aliases as a command option.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#setAllowsUnregisteredOption(boolean)">setAllowsUnregisteredOption</a></strong>(boolean&nbsp;allowsUnregisteredOption)</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#setFrom(java.lang.String[])">setFrom</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;args)</code>
<div class="block">Set the option values from the given arguments.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../openbook/tools/CommandProcessor.html#setFrom(java.lang.String[],%20int,%20int)">setFrom</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;args,
int&nbsp;from,
int&nbsp;to)</code>
<div class="block">Set the option values from the given arguments between the given indices.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="CommandProcessor()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CommandProcessor</h4>
<pre>public&nbsp;CommandProcessor()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="setFrom(java.lang.String[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setFrom</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;setFrom(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;args)</pre>
<div class="block">Set the option values from the given arguments.
All elements of the given array is <em>not</em> consumed,
only till the index that appears to be a valid option.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>args</code> - an array of arguments.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the array elements that are not consumed.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../openbook/tools/CommandProcessor.html#lastIndex(java.lang.String[])"><code>lastIndex(String[])</code></a></dd></dl>
</li>
</ul>
<a name="setFrom(java.lang.String[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setFrom</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;setFrom(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;args,
int&nbsp;from,
int&nbsp;to)</pre>
<div class="block">Set the option values from the given arguments between the given indices.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>args</code> - an array of arguments.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the array elements that are not consumed.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../openbook/tools/CommandProcessor.html#lastIndex(java.lang.String[])"><code>lastIndex(String[])</code></a></dd></dl>
</li>
</ul>
<a name="lastIndex(java.lang.String[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lastIndex</h4>
<pre>public&nbsp;int&nbsp;lastIndex(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;args)</pre>
<div class="block">Gets the last index in the given array that can be processed as an option.
The array elements are sequentially tested if they are a valid option name
(i.e. starts with - character) and if valid then the next element is consumed
as value, if the option requires a value. The search ends when either
the array is exhausted or encounters elements that are not options.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>args</code> - an array of arguments</dd>
<dt><span class="strong">Returns:</span></dt><dd>the last index that will/can be consumed by this processor.</dd></dl>
</li>
</ul>
<a name="register(boolean, java.lang.String...)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre>public&nbsp;<a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a>&nbsp;register(boolean&nbsp;requiresValue,
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>...&nbsp;aliases)</pre>
<div class="block">Register the given aliases as a command option.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>requiresValue</code> - if true then the option must be specified with a value.</dd><dd><code>aliases</code> - strings to recognize this option. Each must begin with a dash character.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the command that is registered</dd></dl>
</li>
</ul>
<a name="findCommand(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>findCommand</h4>
<pre>public&nbsp;<a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a>&nbsp;findCommand(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;option)</pre>
<div class="block">Finds a command with the given name.
If no command has been registered with the given name, but this processor
allows unrecognized options, then as a result of this call, the
unknown name is registered as an option.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>option</code> - a command alias.</dd>
<dt><span class="strong">Returns:</span></dt><dd>null if the given String is not a valid command option name.</dd></dl>
</li>
</ul>
<a name="getUnregisteredCommands()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUnregisteredCommands</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;<a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools">CommandProcessor.Option</a>&gt;&nbsp;getUnregisteredCommands()</pre>
<div class="block">Gets all the unrecognized command options.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>empty set if no commands are unrecognized.</dd></dl>
</li>
</ul>
<a name="getValue(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getValue(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;alias)</pre>
<div class="block">Gets value of the option matching the given alias.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>alias</code> - an alias.</dd>
<dt><span class="strong">Returns:</span></dt><dd>value of the given option.</dd></dl>
</li>
</ul>
<a name="getAllowsUnregisteredOption()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAllowsUnregisteredOption</h4>
<pre>public&nbsp;boolean&nbsp;getAllowsUnregisteredOption()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>the allowsUnregisteredOption</dd></dl>
</li>
</ul>
<a name="setAllowsUnregisteredOption(boolean)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setAllowsUnregisteredOption</h4>
<pre>public&nbsp;void&nbsp;setAllowsUnregisteredOption(boolean&nbsp;allowsUnregisteredOption)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>allowsUnregisteredOption</code> - the allowsUnregisteredOption to set</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/CommandProcessor.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>Prev Class</li>
<li><a href="../../openbook/tools/CommandProcessor.Option.html" title="class in openbook.tools"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?openbook/tools/CommandProcessor.html" target="_top">Frames</a></li>
<li><a href="CommandProcessor.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:&nbsp;</li>
<li><a href="#nested_class_summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2006&#x2013;2018 <a href="http://www.apache.org">Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>