public class Option extends Object implements RevisionHandler
Typical usage:
Option myOption = new Option("Uses extended mode.", "E", 0, "-E"));
| Constructor and Description |
|---|
Option(String description,
String name,
int numArguments,
String synopsis)
Creates new option with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteFlagString(List<String> list,
String name)
Removes an option from a given list of strings that specifies options.
|
static void |
deleteOption(List<Option> list,
String name)
Removes an option from a given list of options.
|
static void |
deleteOptionString(List<String> list,
String name)
Removes an option from a given list of strings that specifies options.
|
String |
description()
Returns the option's description.
|
static String[] |
getOptions(Object target,
Class<?> targetClazz)
Get the settings of the supplied object.
|
static String[] |
getOptionsForHierarchy(Object target,
Class<?> oldestAncestorClazz)
Get the settings of the supplied object.
|
String |
getRevision()
Returns the revision string.
|
static Vector<Option> |
listOptionsForClass(Class<?> clazz)
Gets a list of options for the supplied class.
|
static Vector<Option> |
listOptionsForClassHierarchy(Class<?> childClazz,
Class<?> oldestAncestorClazz)
Get a list of options for a class.
|
String |
name()
Returns the option's name.
|
int |
numArguments()
Returns the option's number of arguments.
|
static void |
setOptions(String[] options,
Object target,
Class<?> targetClazz)
Sets options on the target object.
|
static void |
setOptionsForHierarchy(String[] options,
Object target,
Class<?> oldestAncestorClazz)
Sets options on the target object.
|
String |
synopsis()
Returns the option's synopsis.
|
public static Vector<Option> listOptionsForClassHierarchy(Class<?> childClazz, Class<?> oldestAncestorClazz)
childClazz - the class to get options foroldestAncestorClazz - the oldest superclass (inclusive) at which to
stop getting options frompublic static Vector<Option> listOptionsForClass(Class<?> clazz)
clazz - the class to examine for optionspublic static String[] getOptionsForHierarchy(Object target, Class<?> oldestAncestorClazz)
target - the target object to get settings foroldestAncestorClazz - the oldest superclass at which to stop getting
options frompublic static String[] getOptions(Object target, 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(String[] options, Object target, 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(String[] options, Object target, 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(List<Option> list, String name)
list - the list to reducename - the name of the optionpublic static void deleteOptionString(List<String> list, String name)
list - the list to reducename - the name of the option (including hyphen)public static void deleteFlagString(List<String> list, String name)
list - the list to reducename - the name of the option (including hyphen)public String description()
public String name()
public int numArguments()
public String synopsis()
public String getRevision()
getRevision in interface RevisionHandlerCopyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.