Methods Summary |
---|
public void | addBoolean(java.lang.String name)
mOptionDescriptions.add( new OptionDesc( name ) );
|
public void | addNonBoolean(java.lang.String name, int numValues)
mOptionDescriptions.add( new OptionDesc( name, numValues ) );
|
public void | addOptions(java.lang.String list)
final String [] names = list.split(" ");
for (int i = 0; i < names.length; ++i) {
final String[] data = names[i].split("" + NUMVALUES_DELIM);
if (data.length == 1) {
addBoolean(data[0]);
} else {
addNonBoolean(data[0],
Integer.valueOf(data[1]).intValue());
}
}
|
public void | checkLegalOption(java.lang.String token)
if ( ! isLegalOption( token ) )
{
throw new IllegalArgumentException( "illegal option: " + token );
}
|
private static void | dm(java.lang.Object o)
System.out.println( o.toString() );
|
com.sun.cli.jmx.cmd.ArgHelperOptionInfoImplBase$OptionDesc | findOptionDesc(java.lang.String token)
OptionDesc info = null;
final String optionName = tokenToOptionName( OptionDesc.mapName( token ) );
final Iterator iter = mOptionDescriptions.iterator();
while( iter.hasNext() )
{
final OptionDesc optionDesc = (OptionDesc)iter.next();
if ( optionDesc.mName.equalsIgnoreCase( optionName ) )
{
info = optionDesc;
break;
}
}
return( info );
|
public void | foundIllegalOption(java.lang.String token)
throw new ArgHelper.IllegalOptionException( "illegal option: " + token );
|
public int | getNumValues(java.lang.String token)
checkLegalOption( token );
final OptionDesc info = findOptionDesc( token );
return( info.mNumValues );
|
public boolean | isBoolean(java.lang.String token)
checkLegalOption( token );
final OptionDesc info = findOptionDesc( token );
return( info.mIsBoolean );
|
public boolean | isLegalOption(java.lang.String token)
final boolean isLegal = (findOptionDesc( token ) != null);
return( isLegal );
|
public java.lang.String | tokenToOptionData(java.lang.String token)
final int delimIndex = token.indexOf( '=" );
String data = null; // return null if no data eg "--foo"
if ( delimIndex > 0 )
{
// note: form "--foo=" is valid and should result in an empty string
data = token.substring( delimIndex + 1, token.length() );
}
return( data );
|
public java.lang.String | tokenToOptionName(java.lang.String token)
final int delimIndex = token.indexOf( '=" );
String name = token;
if ( delimIndex > 0 )
{
name = token.substring( 0, delimIndex );
}
return( name );
|