org.apache.felix.gogo.options

## Interface Option

All Known Implementing Classes:
  Options

    public interface Option

### Method Summary

All Methods Instance Methods Abstract Methods
`List<Object>` `argObjects()` get remaining non-options args as Objects.
`List<String>` `args()` get remaining non-options args as Strings.
`String` `get(String name)` get value of named option.
`List<String>` `getList(String name)` get list of all values for named option.
`int` `getNumber(String name)` get value of named option as a Number.
`Object` `getObject(String name)` get value of named option as an Object.
`List<Object>` `getObjectList(String name)` get list of all Object values for named option.
`boolean` `isSet(String name)` test whether specified option has been explicitly set.
`Option` `parse(List<?> argv)` parse arguments.
`Option` `parse(List<?> argv, boolean skipArg0)` parse arguments.
`Option` `parse(Object[] argv)` parse arguments.
`Option` `parse(Object[] argv, boolean skipArg0)` parse arguments.
`Option` `setOptionsFirst(boolean optionsFirst)` require options to precede args.
`Option` `setStopOnBadOption(boolean stopOnBadOption)` stop parsing on the first unknown option.
`void` `usage()` print usage message to System.err.
`IllegalArgumentException` `usageError(String error)` print specified usage error to System.err.

### Method Detail

#### setStopOnBadOption

    Option setStopOnBadOption(boolean stopOnBadOption)

stop parsing on the first unknown option. This allows one parser to get its own options and then pass the remaining options to another parser.

Parameters:
  `stopOnBadOption` - stopOnBadOption
Returns:
  Option

#### setOptionsFirst

    Option setOptionsFirst(boolean optionsFirst)

require options to precede args. Default is false, so options can appear between or after args.

Parameters:
  `optionsFirst` - optionsFirst
Returns:
  Option

#### parse

    Option parse(List<?> argv,
                 boolean skipArg0)

parse arguments. If skipArgv0 is true, then parsing begins at arg1. This allows for commands where argv0 is the command name rather than a real argument.

Parameters:
  `argv` - argv
  `skipArg0` - skipArg0
Returns:
  Option

#### parse

    Option parse(List<?> argv)

parse arguments. See `parse(List, boolean)`

Parameters:
  `argv` - the arg
Returns:
  Option

#### parse

    Option parse(Object[] argv,
                 boolean skipArg0)

parse arguments. See `parse(List, boolean)`

Parameters:
  `argv` - the arg
  `skipArg0` - skipArg0
Returns:
  Option

#### parse

    Option parse(Object[] argv)

parse arguments. See `parse(List, boolean)`

Parameters:
  `argv` - argv
Returns:
  Option

#### isSet

    boolean isSet(String name)

test whether specified option has been explicitly set.

Parameters:
  `name` - name
Returns:
  boolean

#### get

    String get(String name)

get value of named option. If multiple options given, this method returns the last one. Use `getList(String)` to get all values.

Parameters:
  `name` - the name
Returns:
  String
Throws:
  `IllegalArgumentException` - if value is not a String.

#### getList

    List<String> getList(String name)

get list of all values for named option.

Parameters:
  `name` - the name
Returns:
  empty list if option not given and no default specified.
Throws:
  `IllegalArgumentException` - if all values are not Strings.

#### getObject

    Object getObject(String name)

get value of named option as an Object. If multiple options given, this method returns the last one. Use `getObjectList(String)` to get all values.

Parameters:
  `name` - the name
Returns:
  Object

#### getObjectList

    List<Object> getObjectList(String name)

get list of all Object values for named option.

Parameters:
  `name` - the name
Returns:
  List<Object>

#### getNumber

    int getNumber(String name)

get value of named option as a Number.

Parameters:
  `name` - the name
Returns:
  int
Throws:
  `IllegalArgumentException` - if argument is not a Number.

#### args

    List<String> args()

get remaining non-options args as Strings.

Returns:
  List<String>
Throws:
  `IllegalArgumentException` - if args are not Strings.

#### argObjects

    List<Object> argObjects()

get remaining non-options args as Objects.

Returns:
  List<Object>

#### usage

    void usage()

print usage message to System.err.

#### usageError

    IllegalArgumentException usageError(String error)

print specified usage error to System.err. You should explicitly throw the returned exception.

Parameters:
  `error` - the error
Returns:
  IllegalArgumentException