|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object abbot.script.ArgumentParser
public class ArgumentParser
Provide parsing of a String into an array of appropriately typed
arguments. Arrays are indicated by square brackets, and arguments are
separated by commas, e.g.
Field Summary | |
---|---|
static String |
DEFAULT_TOSTRING
|
static String |
ESC_COMMA
|
static String |
NULL
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ESC_COMMA
public static final String NULL
public static final String DEFAULT_TOSTRING
Method Detail |
---|
public static Parser setParser(Class cls, Parser parser)
public static Parser getParser(Class cls)
public static String encodeArguments(String[] args)
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |