The specification string has the general form
optionNames %
conversionCode [{
rangeSpec}
] [X
multiplier] [#
valueDescription] [#
optionDescription]
where
-f, --file
). %
character, specifying information about what value the option requires: %f | a floating point number |
%i | an integer, in either decimal, hex (if preceeded by 0x ), or octal (if preceeded by 0 ) |
%d | a decimal integer |
%o | an octal integer |
%h | a hex integer (without the preceeding 0x ) |
%c | a single character, including escape sequences (such as \n or \007 ), and optionally enclosed in single quotes |
%b | a boolean value (true or false ) |
%s | a string. This will be the argument string itself (or its remainder, in the case of a single word option) |
%v | no explicit value is expected, but a boolean value of true (by default) will be stored into the associated result holder if this option is matched. If one wishes to have a value of false stored instead, then the %v should be followed by a "range spec" containing false , as in %v{false} . |
Examples:
A range spec of {2,4,8,16}
for an integer value will allow the integers 2, 4, 8, or 16.
A range spec of {[-1.0,1.0]}
for a floating point value will allow any floating point number in the range -1.0 to 1.0.
A range spec of {(-88,100],1000}
for an integer value will allow values > -88 and <= 100, as well as 1000.
A range spec of {"foo", "bar", ["aaa","zzz")}
for a string value will allow strings equal to "foo"
or "bar"
, plus any string lexically greater than or equal to "aaa"
but less then "zzz"
.
X
character, indicating the number of values which the option expects. If the multiplier is not specified, it is assumed to be 1. If the multiplier value is greater than 1, then the result holder should be either an array (of appropriate type) with a length greater than or equal to the multiplier value, or a java.util.Vector
as discussed below. #
characters. The final #
character initiates the option description, which may be empty. The value description is used in generating help messages. #
character and the end of the specification string. The option description is used in generating help messages. The result holder must be an object capable of holding a value compatible with the conversion code, or it must be a java.util.Vector
. When the option is matched, its associated value is placed in the result holder. If the same option is matched repeatedly, the result holder value will be overwritten, unless the result holder is a java.util.Vector
, in which case new holder objects for each match will be allocated and added to the vector. Thus if multiple instances of an option are desired by the program, the result holder should be a java.util.Vector
.
If the result holder is not a Vector
, then it must correspond as follows to the conversion code:
%i , %d , %x , %o | {@link argparser.IntHolder IntHolder}, {@link argparser.LongHolder LongHolder}, int[] , or long[] |
%f | {@link argparser.FloatHolder FloatHolder}, {@link argparser.DoubleHolder DoubleHolder}, float[] , or double[] |
%b , %v | {@link argparser.BooleanHolder BooleanHolder} orboolean[] |
%s | {@link argparser.StringHolder StringHolder} orString[] |
%c | {@link argparser.CharHolder CharHolder} orchar[] |
In addition, if the multiplier is greater than 1, then only the array type indicated above may be used, and the array must be at least as long as the multiplier.
%i , %d , %x , %o | {@link argparser.LongHolder LongHolder}, or long[] if the multiplier value exceeds 1 |
%f | {@link argparser.DoubleHolder DoubleHolder}, or double[] if the multiplier value exceeds 1 |
%b , %v | {@link argparser.BooleanHolder BooleanHolder}, or boolean[] if the multiplier value exceeds 1 |
%s | {@link argparser.StringHolder StringHolder}, or String[] if the multiplier value exceeds 1 |
%c | {@link argparser.CharHolder CharHolder}, or char[] if the multiplier value exceeds 1 |
This method adds an option to the LayoutComponent. Options may be useful in constructing the LayoutComponent.
@param name The name of the option @param value The value of the option (may be List or String)null
if the option has no value
String
name, not null
@param value Strong
name, not null
opt
to this group
@param opt the option to add to this group
@return this option group with opt added
If you add a future object, subsequent gets will wait for the result
WARNING: Be careful about what you put in here. Don't create references across classloaders, if you are not sure add a WeakReference to the information. @param name the name @param option the option, pass null to remove an option @throws IllegalArgumentException for a null name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|