com.sun.grid.jgdi.util.shell
Class OptionInfo

java.lang.Object
  extended by com.sun.grid.jgdi.util.shell.OptionInfo

public class OptionInfo
extends java.lang.Object

OptionInfo class holds information about the command option


Constructor Summary
OptionInfo(OptionDescriptor od, java.util.List<java.util.List<java.lang.String>> args, java.util.Map<java.lang.String,OptionDescriptor> map)
          Constructs OptionInfo class
OptionInfo(OptionDescriptor od, java.util.Map<java.lang.String,OptionDescriptor> map)
          Constructs OptionInfo class
 
Method Summary
 java.util.List<java.lang.String> getArgs()
          Gets the arguments.
 java.lang.String getArgsAsString()
          Gets the arguments
 java.lang.String getFirstArg()
          Contract method.
 java.util.List<java.lang.String> getLastOriginalArgList()
          Contract method.
 java.util.Map<java.lang.String,OptionDescriptor> getMap()
          Getter method
 java.lang.reflect.Method getMethod()
          Getter method
 OptionDescriptor getOd()
          Getter method
 java.util.List<java.util.List<java.lang.String>> getOriginalArgs()
          Gets the arguments
 void invokeOption(AnnotatedCommand command)
          Invokes the method for current option in a loop until all argumetns are processed.
 boolean isOptionDone()
           
 void optionDone()
          Contract method.
 java.lang.String showLastArg()
          Contract method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionInfo

public OptionInfo(OptionDescriptor od,
                  java.util.List<java.util.List<java.lang.String>> args,
                  java.util.Map<java.lang.String,OptionDescriptor> map)
Constructs OptionInfo class

Parameters:
od -
args - List> of arguments for the current option
map -

OptionInfo

public OptionInfo(OptionDescriptor od,
                  java.util.Map<java.lang.String,OptionDescriptor> map)
Constructs OptionInfo class

Parameters:
od - tho option descriptor class
map - a map of
Method Detail

invokeOption

public void invokeOption(AnnotatedCommand command)
                  throws java.lang.Exception
Invokes the method for current option in a loop until all argumetns are processed. NOTE: Use getFirstArg() and optionDone() to avoid infinite loop.

Throws:
java.lang.Exception
See Also:
OptionInfo#optionDone() {@link OptionInfo}

getArgs

public java.util.List<java.lang.String> getArgs()
Gets the arguments. developer is responsible for calling optionDone() method to avoid infinity loop.

Returns:
List of option arguments

getOriginalArgs

public java.util.List<java.util.List<java.lang.String>> getOriginalArgs()
Gets the arguments

Returns:
List> of original option arguments (comma separated lists are sub lists)

getArgsAsString

public java.lang.String getArgsAsString()
Gets the arguments

Returns:
List of option arguments

getMethod

public java.lang.reflect.Method getMethod()
Getter method

Returns:
value

getOd

public OptionDescriptor getOd()
Getter method

Returns:
value

optionDone

public void optionDone()
Contract method. Terminates option loop. Should be called at the at of every option.

See Also:
getFirstArg()

getFirstArg

public java.lang.String getFirstArg()
Contract method. Developer should use it to retrieve option arguments one-by-one. So the option loop is terminated.

Returns:
String - first argument of the option or null if no arg

getLastOriginalArgList

public java.util.List<java.lang.String> getLastOriginalArgList()
Contract method. Developer should use it to retreave last comma separated argument.

Returns:
List - last comma separated argument

showLastArg

public java.lang.String showLastArg()
Contract method. Developer should use it to retreave look at the last argument. So the option loop is terminated.

Returns:
String - last argument of the option or null if no arg

getMap

public java.util.Map<java.lang.String,OptionDescriptor> getMap()
Getter method

Returns:
value

isOptionDone

public boolean isOptionDone()


Copyright © 2007 Sun Microsystems, Inc. All rights reserved.