org.apache.felix.gogo.options

## Class Options

- java.lang.Object
- - org.apache.felix.gogo.options.Options

All Implemented Interfaces:
  Option

    public class Options
    extends Object
    implements Option

Yet another GNU long options parser. This one is configured by parsing its Usage string.

### Field Summary

Fields
`static String` `NL`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`List<Object>` `argObjects()` get remaining non-options args as Objects.
`List<String>` `args()` get remaining non-options args as Strings.
`static Option` `compile(String optSpec)`
`static Option` `compile(String[] optSpec)`
`static Option` `compile(String[] optSpec, Option gopt)`
`static Option` `compile(String[] optSpec, String[] gspec)`
`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.
`static void` `main(String[] args)`
`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.
`String` `toString()`
`void` `usage()` print usage message to System.err.
`IllegalArgumentException` `usageError(String s)` prints usage message and returns IllegalArgumentException, for you to throw.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### NL

    public static final String NL

### Method Detail

#### main

    public static void main(String[] args)

#### compile

    public static Option compile(String[] optSpec)

#### compile

    public static Option compile(String optSpec)

#### compile

    public static Option compile(String[] optSpec,
                                 Option gopt)

#### compile

    public static Option compile(String[] optSpec,
                                 String[] gspec)

#### setStopOnBadOption

    public Option setStopOnBadOption(boolean stopOnBadOption)

Description copied from interface: `Option`
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.

Specified by:
  `setStopOnBadOption` in interface `Option`
Parameters:
  `stopOnBadOption` - stopOnBadOption
Returns:
  Option

#### setOptionsFirst

    public Option setOptionsFirst(boolean optionsFirst)

Description copied from interface: `Option`
require options to precede args. Default is false, so options can appear between or after args.

Specified by:
  `setOptionsFirst` in interface `Option`
Parameters:
  `optionsFirst` - optionsFirst
Returns:
  Option

#### isSet

    public boolean isSet(String name)

Description copied from interface: `Option`
test whether specified option has been explicitly set.

Specified by:
  `isSet` in interface `Option`
Parameters:
  `name` - name
Returns:
  boolean

#### getObject

    public Object getObject(String name)

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

Specified by:
  `getObject` in interface `Option`
Parameters:
  `name` - the name
Returns:
  Object

#### getObjectList

    public List<Object> getObjectList(String name)

Description copied from interface: `Option`
get list of all Object values for named option.

Specified by:
  `getObjectList` in interface `Option`
Parameters:
  `name` - the name
Returns:
  List<Object>

#### getList

    public List<String> getList(String name)

Description copied from interface: `Option`
get list of all values for named option.

Specified by:
  `getList` in interface `Option`
Parameters:
  `name` - the name
Returns:
  empty list if option not given and no default specified.

#### get

    public String get(String name)

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

Specified by:
  `get` in interface `Option`
Parameters:
  `name` - the name
Returns:
  String

#### getNumber

    public int getNumber(String name)

Description copied from interface: `Option`
get value of named option as a Number.

Specified by:
  `getNumber` in interface `Option`
Parameters:
  `name` - the name
Returns:
  int

#### argObjects

    public List<Object> argObjects()

Description copied from interface: `Option`
get remaining non-options args as Objects.

Specified by:
  `argObjects` in interface `Option`
Returns:
  List<Object>

#### args

    public List<String> args()

Description copied from interface: `Option`
get remaining non-options args as Strings.

Specified by:
  `args` in interface `Option`
Returns:
  List<String>

#### usage

    public void usage()

Description copied from interface: `Option`
print usage message to System.err.

Specified by:
  `usage` in interface `Option`

#### usageError

    public IllegalArgumentException usageError(String s)

prints usage message and returns IllegalArgumentException, for you to throw.

Specified by:
  `usageError` in interface `Option`
Parameters:
  `s` - the error
Returns:
  IllegalArgumentException

#### parse

    public Option parse(Object[] argv)

Description copied from interface: `Option`
parse arguments. See `Option.parse(List, boolean)`

Specified by:
  `parse` in interface `Option`
Parameters:
  `argv` - argv
Returns:
  Option

#### parse

    public Option parse(List<?> argv)

Description copied from interface: `Option`
parse arguments. See `Option.parse(List, boolean)`

Specified by:
  `parse` in interface `Option`
Parameters:
  `argv` - the arg
Returns:
  Option

#### parse

    public Option parse(Object[] argv,
                        boolean skipArg0)

Description copied from interface: `Option`
parse arguments. See `Option.parse(List, boolean)`

Specified by:
  `parse` in interface `Option`
Parameters:
  `argv` - the arg
  `skipArg0` - skipArg0
Returns:
  Option

#### parse

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

Description copied from interface: `Option`
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.

Specified by:
  `parse` in interface `Option`
Parameters:
  `argv` - argv
  `skipArg0` - skipArg0
Returns:
  Option

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`