Package org.apache.felix.gogo.options
Class Options
- java.lang.Object
-
- org.apache.felix.gogo.options.Options
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.Object>
argObjects()
get remaining non-options args as Objects.java.util.List<java.lang.String>
args()
get remaining non-options args as Strings.static Option
compile(java.lang.String optSpec)
static Option
compile(java.lang.String[] optSpec)
static Option
compile(java.lang.String[] optSpec, java.lang.String[] gspec)
static Option
compile(java.lang.String[] optSpec, Option gopt)
java.lang.String
get(java.lang.String name)
get value of named option.java.util.List<java.lang.String>
getList(java.lang.String name)
get list of all values for named option.int
getNumber(java.lang.String name)
get value of named option as a Number.java.lang.Object
getObject(java.lang.String name)
get value of named option as an Object.java.util.List<java.lang.Object>
getObjectList(java.lang.String name)
get list of all Object values for named option.boolean
isSet(java.lang.String name)
test whether specified option has been explicitly set.static void
main(java.lang.String[] args)
Option
parse(java.lang.Object[] argv)
parse arguments.Option
parse(java.lang.Object[] argv, boolean skipArg0)
parse arguments.Option
parse(java.util.List<? extends java.lang.Object> argv)
parse arguments.Option
parse(java.util.List<? extends java.lang.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.java.lang.String
toString()
void
usage()
print usage message to System.err.java.lang.IllegalArgumentException
usageError(java.lang.String s)
prints usage message and returns IllegalArgumentException, for you to throw.
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
compile
public static Option compile(java.lang.String[] optSpec)
-
compile
public static Option compile(java.lang.String optSpec)
-
compile
public static Option compile(java.lang.String[] optSpec, java.lang.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 interfaceOption
-
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 interfaceOption
-
isSet
public boolean isSet(java.lang.String name)
Description copied from interface:Option
test whether specified option has been explicitly set.
-
getObject
public java.lang.Object getObject(java.lang.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. UseOption.getObjectList(String)
to get all values.
-
getObjectList
public java.util.List<java.lang.Object> getObjectList(java.lang.String name)
Description copied from interface:Option
get list of all Object values for named option.- Specified by:
getObjectList
in interfaceOption
- Returns:
-
getList
public java.util.List<java.lang.String> getList(java.lang.String name)
Description copied from interface:Option
get list of all values for named option.
-
get
public java.lang.String get(java.lang.String name)
Description copied from interface:Option
get value of named option. If multiple options given, this method returns the last one. UseOption.getList(String)
to get all values.
-
getNumber
public int getNumber(java.lang.String name)
Description copied from interface:Option
get value of named option as a Number.
-
argObjects
public java.util.List<java.lang.Object> argObjects()
Description copied from interface:Option
get remaining non-options args as Objects.- Specified by:
argObjects
in interfaceOption
- Returns:
-
args
public java.util.List<java.lang.String> args()
Description copied from interface:Option
get remaining non-options args as Strings.
-
usage
public void usage()
Description copied from interface:Option
print usage message to System.err.
-
usageError
public java.lang.IllegalArgumentException usageError(java.lang.String s)
prints usage message and returns IllegalArgumentException, for you to throw.- Specified by:
usageError
in interfaceOption
- Returns:
- IllegalArgumentException
-
parse
public Option parse(java.lang.Object[] argv)
Description copied from interface:Option
parse arguments.
-
parse
public Option parse(java.util.List<? extends java.lang.Object> argv)
Description copied from interface:Option
parse arguments.
-
parse
public Option parse(java.lang.Object[] argv, boolean skipArg0)
Description copied from interface:Option
parse arguments.
-
parse
public Option parse(java.util.List<? extends java.lang.Object> 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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-