public class CliTools extends Object
Modifier and Type | Method and Description |
---|---|
static String[] |
configureBean(Object bean,
String[] args)
Configure a JavaBean based on a set of command line arguments.
|
static <T extends Enum<?>> |
getEnumValuesAsString(Class<T> enumClass)
Constructs a comma-separated list of values for an enum.
|
public static String[] configureBean(Object bean, String[] args) throws ConfigurationException
BeanInfo
(usually obtained by introspection)
to find a property named "foo". The argument will be interpreted
according to the type of the "foo" property, then the appropriate
mutator method (generally named setFoo) will be called to configure
the property on the bean.
Currently supported property types are int, double,
boolean, String, File, Reader, Writer, InputStream, OutputStream, Enum
,
plus arrays of all the above types. In the case of arrays, the option
may appear multiple times on the command line, otherwise recurrance of
the same option is an error.
For stream types, the parameter is interpreted as a filename unless it is equal to "-" in which case standard input or standard output are used as appropriate. Each of the standard streams may only be used one.
In the future, this method will probably be extended to handle multiple parameter occurances, and use Annotations to generate more useful help messages when something goes wrong.
bean
- args
- ConfigurationException
public static <T extends Enum<?>> String getEnumValuesAsString(Class<T> enumClass)
enumClass
- Copyright © 2000–2016 BioJava. All rights reserved.