| java.lang.Object org.python.core.ArgParser
ArgParser | public class ArgParser (Code) | | A utility class for handling mixed positional and keyword arguments.
A typical usage:
public MatchObject search(PyObject[] args, String[] kws) {
ArgParser ap = new ArgParser("search", args, kws,
"pattern", "pos", "endpos");
String string = ap.getString(0);
int start = ap.getInt(1, 0);
int end = ap.getInt(2, string.length());
...
|
Constructor Summary | |
public | ArgParser(String funcname, PyObject[] args, String[] kws, String p0) Create an ArgParser with one method argument
Parameters: funcname - Name of the method. | public | ArgParser(String funcname, PyObject[] args, String[] kws, String p0, String p1) Create an ArgParser with two method argument
Parameters: funcname - Name of the method. | public | ArgParser(String funcname, PyObject[] args, String[] kws, String p0, String p1, String p2) Create an ArgParser with three method argument
Parameters: funcname - Name of the method. | public | ArgParser(String funcname, PyObject[] args, String[] kws, String[] paramnames) Create an ArgParser with three method argument
Parameters: funcname - Name of the method. | public | ArgParser(String funcname, PyObject[] args, String[] kws, String[] paramnames, int minargs) |
Method Summary | |
public int | getInt(int pos) Return a required argument as an int.
Parameters: pos - The position of the argument. | public int | getInt(int pos, int def) Return an optional argument as an int.
Parameters: pos - The position of the argument. | public PyObject | getList(int pos) Return the remaining arguments as a tuple.
Parameters: pos - The position of the argument. | public PyObject | getPyObject(int pos) Return a required argument as a PyObject.
Parameters: pos - The position of the argument. | public PyObject | getPyObject(int pos, PyObject def) Return an optional argument as a PyObject.
Parameters: pos - The position of the argument. | public String | getString(int pos) Return a required argument as a String.
Parameters: pos - The position of the .. | public String | getString(int pos, String def) Return an optional argument as a String.
Parameters: pos - The position of the argument. |
ArgParser | public ArgParser(String funcname, PyObject[] args, String[] kws, String p0)(Code) | | Create an ArgParser with one method argument
Parameters: funcname - Name of the method. Used in error messages. Parameters: args - The actual call arguments supplied in the call. Parameters: kws - The actual keyword names supplied in the call. Parameters: p0 - The expected argument in the method definition. |
ArgParser | public ArgParser(String funcname, PyObject[] args, String[] kws, String p0, String p1)(Code) | | Create an ArgParser with two method argument
Parameters: funcname - Name of the method. Used in error messages. Parameters: args - The actual call arguments supplied in the call. Parameters: kws - The actual keyword names supplied in the call. Parameters: p0 - The first expected argument in the method definition. Parameters: p1 - The second expected argument in the method definition. |
ArgParser | public ArgParser(String funcname, PyObject[] args, String[] kws, String p0, String p1, String p2)(Code) | | Create an ArgParser with three method argument
Parameters: funcname - Name of the method. Used in error messages. Parameters: args - The actual call arguments supplied in the call. Parameters: kws - The actual keyword names supplied in the call. Parameters: p0 - The first expected argument in the method definition. Parameters: p1 - The second expected argument in the method definition. Parameters: p2 - The third expected argument in the method definition. |
ArgParser | public ArgParser(String funcname, PyObject[] args, String[] kws, String[] paramnames)(Code) | | Create an ArgParser with three method argument
Parameters: funcname - Name of the method. Used in error messages. Parameters: args - The actual call arguments supplied in the call. Parameters: kws - The actual keyword names supplied in the call. Parameters: paramnames - The list of expected argument in the method definition. |
getInt | public int getInt(int pos)(Code) | | Return a required argument as an int.
Parameters: pos - The position of the argument. First argument is numbered 0. |
getInt | public int getInt(int pos, int def)(Code) | | Return an optional argument as an int.
Parameters: pos - The position of the argument. First argument is numbered 0. |
getList | public PyObject getList(int pos)(Code) | | Return the remaining arguments as a tuple.
Parameters: pos - The position of the argument. First argument is numbered 0. |
getPyObject | public PyObject getPyObject(int pos)(Code) | | Return a required argument as a PyObject.
Parameters: pos - The position of the argument. First argument is numbered 0. |
getPyObject | public PyObject getPyObject(int pos, PyObject def)(Code) | | Return an optional argument as a PyObject.
Parameters: pos - The position of the argument. First argument is numbered 0. |
getString | public String getString(int pos)(Code) | | Return a required argument as a String.
Parameters: pos - The position of the .. First argument is numbered 0. |
getString | public String getString(int pos, String def)(Code) | | Return an optional argument as a String.
Parameters: pos - The position of the argument. First argument is numbered 0. |
|
|