Methods Summary |
---|
void | add(com.sun.cli.jmx.cmd.ArgHelperOptionsInfo$OptionDesc desc)
checkExists( desc.mName );
mOptionDescriptions.put( desc.mName, desc );
|
public void | addBoolean(java.lang.String name)
add( new OptionDesc( name ) );
|
public void | addNonBoolean(java.lang.String name, int numValues)
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());
}
}
|
void | checkExists(java.lang.String optionName)
if ( exists( optionName ) )
{
throw new IllegalArgumentException( "can't add same option twice: " + optionName );
}
|
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() );
|
boolean | exists(java.lang.String optionName)
return( mOptionDescriptions.get( optionName ) != null );
|
com.sun.cli.jmx.cmd.ArgHelperOptionsInfo$OptionDesc | findOptionDesc(java.lang.String token)
final String optionName = tokenToOptionName( OptionDesc.mapName( token ) );
return( (OptionDesc)mOptionDescriptions.get( optionName ) );
|
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)
if ( ! token.startsWith( "-" ) )
{
return( false );
}
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 );
|