ReflectArgumentType instead.public class ConstructorArgumentType<T> extends Object implements ArgumentType<T>
This implementation converts String value into given type using given type's constructor.
The constructor must have 1 String argument. If error occurred inside the
constructor, ArgumentParserException will be thrown. If error
occurred in other locations, subclass of RuntimeException will be
thrown.
| Constructor and Description |
|---|
ConstructorArgumentType(Class<T> type)
Deprecated.
Creates
ConstructorArgumentType object with given type. |
| Modifier and Type | Method and Description |
|---|---|
T |
convert(ArgumentParser parser,
Argument arg,
String value)
Deprecated.
Converts
value to appropriate type. |
public ConstructorArgumentType(Class<T> type)
Creates ConstructorArgumentType object with given type.
The constructor of type must have 1 String argument.
type - The type String value should be converted to.public T convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException
ArgumentType
Converts value to appropriate type.
If the objects derived from RuntimeException are thrown in
conversion because of invalid input from command line, subclass must
catch these exceptions and wrap them in ArgumentParserException
and give simple error message to explain what happened briefly.
convert in interface ArgumentType<T>parser - The aprser.arg - The argument this type attached to.value - The attribute value.ArgumentParserException - If conversion fails.Copyright © 2012–2015. All rights reserved.