public class Option extends java.lang.Object implements RevisionHandler
Typical usage:
Option myOption = new Option("Uses extended mode.", "E", 0, "-E"));
Constructor and Description |
---|
Option(java.lang.String description,
java.lang.String name,
int numArguments,
java.lang.String synopsis)
Creates new option with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
static void |
deleteFlagString(java.util.List<java.lang.String> list,
java.lang.String name)
Removes an option from a given list of strings that specifies options.
|
static void |
deleteOption(java.util.List<Option> list,
java.lang.String name)
Removes an option from a given list of options.
|
static void |
deleteOptionString(java.util.List<java.lang.String> list,
java.lang.String name)
Removes an option from a given list of strings that specifies options.
|
java.lang.String |
description()
Returns the option's description.
|
static java.lang.String[] |
getOptions(java.lang.Object target,
java.lang.Class<?> targetClazz)
Get the settings of the supplied object.
|
static java.lang.String[] |
getOptionsForHierarchy(java.lang.Object target,
java.lang.Class<?> oldestAncestorClazz)
Get the settings of the supplied object.
|
java.lang.String |
getRevision()
Returns the revision string.
|
static java.util.Vector<Option> |
listOptionsForClass(java.lang.Class<?> clazz)
Gets a list of options for the supplied class.
|
static java.util.Vector<Option> |
listOptionsForClassHierarchy(java.lang.Class<?> childClazz,
java.lang.Class<?> oldestAncestorClazz)
Get a list of options for a class.
|
java.lang.String |
name()
Returns the option's name.
|
int |
numArguments()
Returns the option's number of arguments.
|
static void |
setOptions(java.lang.String[] options,
java.lang.Object target,
java.lang.Class<?> targetClazz)
Sets options on the target object.
|
static void |
setOptionsForHierarchy(java.lang.String[] options,
java.lang.Object target,
java.lang.Class<?> oldestAncestorClazz)
Sets options on the target object.
|
java.lang.String |
synopsis()
Returns the option's synopsis.
|
public Option(java.lang.String description, java.lang.String name, int numArguments, java.lang.String synopsis)
description
- the option's descriptionname
- the option's namenumArguments
- the number of argumentssynopsis
- the option's synopsispublic static java.util.Vector<Option> listOptionsForClassHierarchy(java.lang.Class<?> childClazz, java.lang.Class<?> oldestAncestorClazz)
childClazz
- the class to get options foroldestAncestorClazz
- the oldest superclass (inclusive) at which to
stop getting options frompublic static java.util.Vector<Option> listOptionsForClass(java.lang.Class<?> clazz)
clazz
- the class to examine for optionspublic static java.lang.String[] getOptionsForHierarchy(java.lang.Object target, java.lang.Class<?> oldestAncestorClazz)
target
- the target object to get settings foroldestAncestorClazz
- the oldest superclass at which to stop getting
options frompublic static java.lang.String[] getOptions(java.lang.Object target, java.lang.Class<?> targetClazz)
target
- the target to extract settings fromtargetClazz
- the class to consider for obtaining settings - i.e.
annotated methods from this class will have their values
extracted. This class is expected to be either the class of the
target or one of its superclassespublic static void setOptionsForHierarchy(java.lang.String[] options, java.lang.Object target, java.lang.Class<?> oldestAncestorClazz)
options
- the options to settarget
- the target on which to set optionsoldestAncestorClazz
- the oldest superclass at which to stop setting
optionspublic static void setOptions(java.lang.String[] options, java.lang.Object target, java.lang.Class<?> targetClazz)
options
- the options to settarget
- the target on which to set optionstargetClazz
- the class containing options to be be set - i.e.
annotated option methods in this class will have their values set.
This class is expected to be either the class of the target or one
of its superclassespublic static void deleteOption(java.util.List<Option> list, java.lang.String name)
list
- the list to reducename
- the name of the optionpublic static void deleteOptionString(java.util.List<java.lang.String> list, java.lang.String name)
list
- the list to reducename
- the name of the option (including hyphen)public static void deleteFlagString(java.util.List<java.lang.String> list, java.lang.String name)
list
- the list to reducename
- the name of the option (including hyphen)public java.lang.String description()
public java.lang.String name()
public int numArguments()
public java.lang.String synopsis()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler