public class ArgumentParser extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_TOSTRING |
static String |
ESC_COMMA |
static String |
NULL |
Modifier and Type | Method and Description |
---|---|
static String |
encodeArguments(String[] args) |
static Object[] |
eval(Resolver resolver,
String[] args,
Class[] params)
Evaluate the given set of arguments into the given set of types.
|
static Object |
eval(Resolver resolver,
String arg,
Class cls)
Convert the given string into the given class, if possible,
using any available parsers if conversion to basic types fails.
|
static Parser |
getParser(Class cls)
Find a string parser for the given class.
|
static boolean |
isDefaultToString(String s)
Returns whether the given String is the default toString()
implementation for the given Object.
|
static String[] |
parseArgumentList(String encodedArgs)
Convert the given encoded String into an array of Strings.
|
static String |
replace(String str,
String s1,
String s2)
Replace all instances in the given String of s1 with s2.
|
static Parser |
setParser(Class cls,
Parser parser)
Set the parser for a given class.
|
static String |
substitute(Resolver resolver,
String arg)
Performs property substitutions on the argument priort to evaluating
it.
|
static String |
toString(Object value)
Convert a value into a String representation.
|
public static final String ESC_COMMA
public static final String NULL
public static final String DEFAULT_TOSTRING
public static Parser setParser(Class cls, Parser parser)
public static Parser getParser(Class cls)
public static String[] parseArgumentList(String encodedArgs)
Explicit commas and square brackets in arguments must be escaped by preceding the character with a backslash ('\'). The strings '(null)' and 'null' are interpreted as the value null.
Explicit spaces should be protected by double quotes, e.g. " an argument bounded by spaces ".
public static String substitute(Resolver resolver, String arg)
public static Object eval(Resolver resolver, String arg, Class cls) throws IllegalArgumentException, NoSuchReferenceException, ComponentSearchException
Performs property substitution on the argument prior to evaluating it. Spaces are only trimmed from the argument if spaces have no meaning for the target class.
public static Object[] eval(Resolver resolver, String[] args, Class[] params) throws IllegalArgumentException, NoSuchReferenceException, ComponentSearchException
public static String replace(String str, String s1, String s2)
public static String toString(Object value)
public static boolean isDefaultToString(String s)
Abbot is hosted on