com.android.sdklib.util
Class CommandLineParser.Arg

java.lang.Object
  extended by com.android.sdklib.util.CommandLineParser.Arg
Enclosing class:
CommandLineParser

protected static class CommandLineParser.Arg
extends java.lang.Object

An argument accepted by the command-line, also called "a flag". Arguments must have a short version (one letter), a long version name and a description. They can have a default value, or it can be null. Depending on the CommandLineParser.Mode, the default value can be a Boolean, an Integer, a String or a String array (in which case the first item is the current by default.)


Constructor Summary
CommandLineParser.Arg(CommandLineParser.Mode mode, boolean mandatory, java.lang.String verb, java.lang.String directObject, java.lang.String shortName, java.lang.String longName, java.lang.String description, java.lang.Object defaultValue)
          Creates a new argument flag description.
 
Method Summary
 java.lang.Object getCurrentValue()
          Returns the current value.
 java.lang.Object getDefaultValue()
          Returns the default value.
 java.lang.String getDescription()
          Returns the description.
 java.lang.String getDirectObject()
          Returns the direct Object for that argument.
 java.lang.String getLongArg()
          Returns the long name of the argument, e.g.
 CommandLineParser.Mode getMode()
          Returns the argument mode (type + process method).
 java.lang.String getShortArg()
          Returns the 1-letter short name of the argument, e.g.
 java.lang.String getVerb()
          Returns the verb for that argument.
 boolean isInCommandLine()
          Returns true if the argument has been used on the command line.
 boolean isMandatory()
          Return true if this argument is mandatory for this verb/directobject.
 void setCurrentValue(java.lang.Object currentValue)
          Sets the current value.
 void setInCommandLine(boolean inCommandLine)
          Sets if the argument has been used on the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLineParser.Arg

public CommandLineParser.Arg(CommandLineParser.Mode mode,
                             boolean mandatory,
                             @NonNull
                             java.lang.String verb,
                             @NonNull
                             java.lang.String directObject,
                             @NonNull
                             java.lang.String shortName,
                             @NonNull
                             java.lang.String longName,
                             @NonNull
                             java.lang.String description,
                             @Nullable
                             java.lang.Object defaultValue)
Creates a new argument flag description.

Parameters:
mode - The CommandLineParser.Mode for the argument.
mandatory - True if this argument is mandatory for this action.
verb - The verb name. Never null. Can be CommandLineParser.GLOBAL_FLAG_VERB.
directObject - The action name. Can be CommandLineParser.NO_VERB_OBJECT.
shortName - The one-letter short argument name. Can be empty but not null.
longName - The long argument name. Can be empty but not null.
description - The description. Cannot be null.
defaultValue - The default value (or values), which depends on the selected CommandLineParser.Mode. Can be null.
Method Detail

isMandatory

public boolean isMandatory()
Return true if this argument is mandatory for this verb/directobject.


getShortArg

public java.lang.String getShortArg()
Returns the 1-letter short name of the argument, e.g. -v.


getLongArg

public java.lang.String getLongArg()
Returns the long name of the argument, e.g. --verbose.


getDescription

public java.lang.String getDescription()
Returns the description. Never null.


getVerb

public java.lang.String getVerb()
Returns the verb for that argument. Never null.


getDirectObject

public java.lang.String getDirectObject()
Returns the direct Object for that argument. Never null, but can be empty string.


getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value. Can be null.


getCurrentValue

public java.lang.Object getCurrentValue()
Returns the current value. Initially set to the default value. Can be null.


setCurrentValue

public void setCurrentValue(java.lang.Object currentValue)
Sets the current value. Can be null.


getMode

public CommandLineParser.Mode getMode()
Returns the argument mode (type + process method). Never null.


isInCommandLine

public boolean isInCommandLine()
Returns true if the argument has been used on the command line.


setInCommandLine

public void setInCommandLine(boolean inCommandLine)
Sets if the argument has been used on the command line.